Image Height and Width

T

Thom Little

I have images of varying sizes on the server and would like to display them
on an aspx. This is easy to do (of course).

imgTest.ImageUrl = "images/image01.jpg" ;

I would like to reserve the display area before the images are loaded.

How can I determine the original height and width of the image prior to it
being loaded and displayed? Is there an article on the subject that you can
point me towards?
 
D

DalePres

using System.Drawing;

then in the method:


Bitmap myBitmap = new Bitmap(@"c:\somepath.jpg")
Size size = myBitmap.Size;

or

Bitmap myBitmap = new Bitmap(@"c:\somepath.jpg")
int width = myBitmap.Width;
int height = myBitmap.Height;

Hope this helps,


Dale
 

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,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top