Getting Size of an Image?

B

Brett Baisley

Hello

I need help with some ASP.net programming. I have a web page that basically
just has the following web components: dropdownlist, listbox and image.

I am using VB.net with a CodeBehind file to read the contents of a directory
into the dropdownlist. Then when the user picks one, it displays a list of
the images in that dir in the listbox. Then when you pick a filename from
the listbox, it displays the image.

It all works, but I would like to do is if the image is bigger then 500
pixels in width, I would like it to scale the image accordingly to max out
at 500.

The part I am having trouble is getting the size of the image to check it.
Can anyone help?
 
S

Scott Mitchell [MVP]

Brett said:
I need help with some ASP.net programming. I have a web page that basically
just has the following web components: dropdownlist, listbox and image.

It all works, but I would like to do is if the image is bigger then 500
pixels in width, I would like it to scale the image accordingly to max out
at 500.

Brett, check out this article:

Displaying a List of Scaled Images
http://aspnet.4guysfromrolla.com/articles/011503-1.aspx

The article shows how to dynamically determine an image's height & width
in pixels.

--

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top