Obtaining Width and Height for an Image

S

Sharlet

I am having a problem here. I have an ASP page which
displays different images according to the querystring and
the images are all of different sizes. However, in some
browsers the image overlaps with the text next to it
occasionally.

I guess by specifying the "width" and "height" of the
image in the HTML should solve the problem. However, I do
not want to store the width and height of each image in
the database. (There are too many of them!) Is there any
function I can use in my ASP page to obtain the width and
height of an image?

Any help would be very much appreciated!
 
A

Aaron Bertrand - MVP

I guess by specifying the "width" and "height" of the
image in the HTML should solve the problem. However, I do
not want to store the width and height of each image in
the database. (There are too many of them!) Is there any
function I can use in my ASP page to obtain the width and
height of an image?

Well, if you use a script to store these elements in your database *once*,
you will avoid (at the cost of 8 bytes per row).

I would seriously consider storing the data in the database, rather than
using that processing *every* time you load the image.

See the bottom half of http://www.aspfaq.com/2170
 
C

Chris Barber

I've used a little DLL called 'BitmapLibrary' to do this and it works a
treat.

http://www.internext.co.za/stefan/bitmapsize/

Chris.

I am having a problem here. I have an ASP page which
displays different images according to the querystring and
the images are all of different sizes. However, in some
browsers the image overlaps with the text next to it
occasionally.

I guess by specifying the "width" and "height" of the
image in the HTML should solve the problem. However, I do
not want to store the width and height of each image in
the database. (There are too many of them!) Is there any
function I can use in my ASP page to obtain the width and
height of an image?

Any help would be very much appreciated!
 
S

Sharlet

Thanks all for your suggestions. You learn something new
every day. I thought there might be an easier solution
such as a built-in function to do that. I guess in that
case I'd better put them all in the database. (*sign*)
 
C

Chris Barber

Why not code it so that it updates the database itself the first time you
request an image?

Best of both worlds! Add new images to your hearts content and just watch
the database populate itself as the web runs.

Chris.

Thanks all for your suggestions. You learn something new
every day. I thought there might be an easier solution
such as a built-in function to do that. I guess in that
case I'd better put them all in the database. (*sign*)
 

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,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top