Last post May 17, 2008 05:07 AM by dan_abdn
May 16, 2008 05:34 PM|dan_abdn|LINK
Hi guys and gals,
Here's a more interesting question for you (I've not been able to find the answer after hours of experimenting and searching around so here I am).
private byte GetThumbnailData()
MemoryStream m = new MemoryStream();
Bitmap source = new Bitmap(Server.MapPath("~/Images/") + "MyPhoto.jpg");
Bitmap ThumbNail = CreateThumbnail(source, 100, 200, true);
Response.ContentType = "image/jpeg";
1. To display this image (contained within the byte) in an Image or ImageButton control.
I don't want to just display the image on it's own using the response object - that's just naff.
Any tips would be great!
PS. This is so that I can create a thumbnail
May 16, 2008 06:25 PM|ps2goat|LINK
You have to store this file somewhere, and there are essentially two main tricks for this. 1) store a physical file somewhere, or 2) Create a page that just returns an image (which you call naff).
The trick behind #2 is that you pass information to the image generation page to get the actual image you want. For example, if you set the source of an <img> tag to
http://mysite.com/image-generator.aspx?ImageID=22848&thumb=true, then the image generator will create and return the requested image, which is then put into the actual page. It's
a two-part system.
May 17, 2008 04:27 AM|dan_abdn|LINK
I think I'll create the thumb at time of upload.
I really wanted to know how feasible it was in case I needed it in the future. Guess it's not possible to stream an image to an image control. If you find out how - please post here - cheers.
I mean surely people must be saving images into their database and then displaying it on screen in say a gridview or something? surely? no? yes? maybe?
Thanks for the advice.
Don't you just love the word naff :) naff naff naff lol
May 17, 2008 04:45 AM|MightyJay|LINK
You can create an HttpHandler that returns the image from any source (another file, a byte array in a database, etc.). If you do a google search you can find many articles with examples. (just a quick search gave me
this page, but I haven't really looked at it myself, but might be useful)
May 17, 2008 05:07 AM|dan_abdn|LINK
Thanks MightyJay! - I'll take a looky :)