Hello everyone,I am printingimages from a databaseusingDetailsVaiew
andHandler,it works, butnowI do not know
how you can increaseto viewmessages?readthat using
bitmap,but do not knowhow to applyit to yoursituation.
Help please
namespace MySite
{
public class Handler2 : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
string idNews = context.Request.QueryString["idNews"];
SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["WEBNIPIConnectionString"].ConnectionString);
connection.Open();
SqlCommand command = new SqlCommand("select Image from TestNews where Image is NOT NULL and idNews=" + idNews, connection);
SqlDataReader dr = command.ExecuteReader();
if (dr.Read())
context.Response.BinaryWrite((Byte[])dr[0]);
connection.Close();
context.Response.End();
}
public bool IsReusable
{
get
{
return false;
}
}
}
}
ReSonance
Member
10 Points
84 Posts
Resize images from a database with Handler
Dec 21, 2012 10:33 AM|LINK
Hello everyone, I am printing images from a database using DetailsVaiew and Handler, it works, but now I do not know how you can increase to view messages? read that using bitmap, but do not know how to apply it to your situation. Help please
My Detailsview:
<asp:DetailsView ID="DetailsView3" runat="server" AutoGenerateRows="False" BorderWidth="0px" BorderColor="White" DataSourceID="SqlDataSource3" DataKeyNames="idNews" style="margin-top: 0px" GridLines="None" Height="203px" Width="109px"> <Fields> <asp:TemplateField> <ItemTemplate> <img width=175 height=200 src="Handler2.ashx?idNews=<%# Eval("idNews") %>"/> </ItemTemplate> </asp:TemplateField> </Fields> </asp:DetailsView>My handler:
namespace MySite { public class Handler2 : IHttpHandler { public void ProcessRequest(HttpContext context) { string idNews = context.Request.QueryString["idNews"]; SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["WEBNIPIConnectionString"].ConnectionString); connection.Open(); SqlCommand command = new SqlCommand("select Image from TestNews where Image is NOT NULL and idNews=" + idNews, connection); SqlDataReader dr = command.ExecuteReader(); if (dr.Read()) context.Response.BinaryWrite((Byte[])dr[0]); connection.Close(); context.Response.End(); } public bool IsReusable { get { return false; } } } }kedarrkulkar...
All-Star
34285 Points
5514 Posts
Re: Resize images from a database with Handler
Dec 21, 2012 10:58 AM|LINK
read my article...
http://www.bluelemoncode.com/post/2011/06/29/Creating-thumbnail-image-or-compressing-image-size-in-Net.aspx
hope this helps...
KK
Please mark as Answer if post helps in resolving your issue
My Site
ReSonance
Member
10 Points
84 Posts
Re: Resize images from a database with Handler
Dec 21, 2012 01:10 PM|LINK
kedarrkulkarni, thanks, but not likely, my images are not stored physically on the disk and in the database as a byte
ReSonance
Member
10 Points
84 Posts
Re: Resize images from a database with Handler
Dec 24, 2012 04:20 AM|LINK
Decided this question. If anyone is interested, tell us more