Show light weight thumbnail of large images

M

moondaddy

I have an app where users will upload photos to their shopping cart. When
they review their cart I need to include a light weight thumbnail of the
image they uploaded. how can I take the image a user uploaded (PixOfMom.jpg
at 600k) and convert it to a thumbnail and put into the image url of a .net
image control using vb.net 1.1?

Thanks!
 
S

S. Justin Gengo

Moondaddy,

System.Drawing.Image.GetThumbnail is what you need. If you want more detail,
I have an ASP.NET v.1.1 project you can download from my website that uses a
couple of pages to allow a user to upload an image, resize it, and set it's
quality. It does a lot more than what you need here, but if you take a look
at the code you'll see how I'm resizing images and setting their quality
which you can then use to create your thumbnails. All the code on my site is
free.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
M

moondaddy

Nice sample project Justin. I have a few questions though. I'm confused on
how 'ImageDelivery.aspx' got a reference to the image and also I'm not clear
on exactly what its needed for. When posting back the page, isn't there a
way to set the image url to a variable holding the image data? Also, I'm
using a dataset to hold various session data. Could I just use this dataset
to hold the image data in the same way you used the application.item
datatable?

Thanks.


--
(e-mail address removed)
S. Justin Gengo said:
Moondaddy,

System.Drawing.Image.GetThumbnail is what you need. If you want more detail,
I have an ASP.NET v.1.1 project you can download from my website that uses a
couple of pages to allow a user to upload an image, resize it, and set it's
quality. It does a lot more than what you need here, but if you take a look
at the code you'll see how I'm resizing images and setting their quality
which you can then use to create your thumbnails. All the code on my site is
free.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
S

Steven Cheng[MSFT]

Hi Moondaddy,

The Application.Item is application level shared variables and Sessions are
user based( each client request will has identical session). So I think you
should consider whether the data need to be separate from different users,
if so, you should use Session. Otherwise, Application level variables are
ok. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
S

S. Justin Gengo

George,

Emailing me personally is entirely proper! Feel free to contact me whenever
you want.

I love the link you sent:

http://msdn.microsoft.com/msdnmag/issues/04/04/CuttingEdge/

When I created my image manipulation project I was looking for a multi
browser compatible way of delivering an image to a page dynamically and came
across another sample project that showed how to do so. (I don't recall the
link.) The link you sent looks like a much better way to do so! I'll
probably convert mine to use it.

I'm confused on how 'ImageDelivery.aspx' got a reference to the image and
also I'm not clear on exactly what it's needed for.

ImageDelivery.aspx is being sent an image id in the query string: Dim
ImageGuid As String = Request.QueryString("id")

The Guid is being used when the image is stored in the datatable as the row
key. And that is what is used to retrieve the data and send the changed
image to the page display.

One confusing part of the query string may be the random number I'm tacking
on to it. Internet Explorer on the Mac caches images and doesn't check if
the image has changed from one post to another even if caching is turned
off. So I'm adding on the random number just to change the image's url
enough so that IE on the MAC reloads the new image.

When posting back the page, isn't there a way to set the image url to a
variable holding the image data?

It looks like you answered this one yourself with the link you sent me.

Also, I'm using a dataset to hold various session data. Could I just use
this dataset to hold the image data in the same way you used the
application.item datatable?

Yes.

I didn't see any binary data types in the dataset and noticed that you
defined the datatable column like this: ImageTable.Columns.Add(New
DataColumn("OptimizedImage", GetType(Object))) I'm not sure how that would
translate to a strongly typed dataset column.

Technically this column is a strongly typed data column. It's just of the
top type "Object". You could easily change this to be of type stream or
image. I just wanted the flexibility to store most anything in the column
because when I created this project I wasn't positive which I'd be storing
there.



Sincerely,


--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
moondaddy said:
Nice sample project Justin. I have a few questions though. I'm confused on
how 'ImageDelivery.aspx' got a reference to the image and also I'm not clear
on exactly what its needed for. When posting back the page, isn't there a
way to set the image url to a variable holding the image data? Also, I'm
using a dataset to hold various session data. Could I just use this dataset
to hold the image data in the same way you used the application.item
datatable?

Thanks.


--
(e-mail address removed)
S. Justin Gengo said:
Moondaddy,

System.Drawing.Image.GetThumbnail is what you need. If you want more detail,
I have an ASP.NET v.1.1 project you can download from my website that
uses
a
couple of pages to allow a user to upload an image, resize it, and set it's
quality. It does a lot more than what you need here, but if you take a look
at the code you'll see how I'm resizing images and setting their quality
which you can then use to create your thumbnails. All the code on my
site
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top