Last post Jul 26, 2012 05:21 PM by mitja.GTI
Jul 26, 2012 04:58 PM|wsyeager36|LINK
I am rendering an image on a web page via an httphandler.
The ContentType comes out as png and the BinaryWrite statement gets the image from the database.
In our database, we have an imageid in one table which is associated with an image id as a foreign key in another table. The pertinent fields are ImageContent, Filename, Type, and Size.
So, for instnace, two images coming out of the database have these values (I'm excluding the ImageContent, because it's obvioulsy too big):
ImageId Scat Filename Type Size
12 | ac1 | ac1.png | image/png | 16345
259 | AV | AV.png | image/png | 21182
The code for the handler is below. The question is: Is there any way to
set the size of the image in the code behind inside the ProcessRequest method? I need all the image sizes to be 110x110.
[WebService(Namespace = "http://abbconcise.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class GetSalesCategoryImage : IHttpHandler
public void ProcessRequest(HttpContext context)
string salesCategoryToFind = context.Request.QueryString["SalesCategory"];
SalesCategoryImage salesCategoryImage = SalesCategoryImageFactory.FindBySalesCategory(salesCategoryToFind);
context.Response.ContentType = salesCategoryImage.Type;
public bool IsReusable
Jul 26, 2012 05:21 PM|mitja.GTI|LINK
it is possible to resize the image. I would recomend to resize it before you store it unless you need the original format and even then you can create a thumbnail.
There are a lot of example on the net about resizing images in .net. I know I have answered quite a few of those questions myself on this forum and I hate to sound like a parrot. I suggest you to use search engine ;)
A quick search pops out: Resizing an Image without losing any quality
If you have any aditional questions, please feel free to reply.