Help - Search - Members - Calendar
Full Version: Image size/ratio question
HTMLHelp Forums > Web Authoring > Graphics, Flash and Multimedia
CharlesEF
Hi All,

I'm looking for advise on how to handle the next phase of my project. I'm working with images (lets say country flags) and I have 1 main image, about 180 x 100. Not all flags are the same size and some flags have a different ratio when compared to other flags (some are wider, some are higher).

1. If I want to display a smaller version of a flag must I generate an image with the size I want OR can I just write the <img> tag with the size I want?
2. How can I know what size the original image is so I can write the <img> tag in a size that maintains the flag ratio? Is there some way to read this information off the server or do I have to maintain a list of each image size?

I will be using .png when I can otherwise I will use .gif format. Or, am I totally off base with my idea? Can anyone suggest a better way?


Thanks for any ideas,

Charles
Brian Chandler
QUOTE(CharlesEF @ Sep 18 2013, 11:40 AM) *

1. If I want to display a smaller version of a flag must I generate an image with the size I want OR can I just write the <img> tag with the size I want?


Assuming the images are fairly small to start with, you can just resize them (e.g.) to a standard height using CSS, and let the width adjust automatically. Of course if they are 5MB files, you need to resize them to thumbnails.

QUOTE

2. How can I know what size the original image is so I can write the <img> tag in a size that maintains the flag ratio? Is there some way to read this information off the server or do I have to maintain a list of each image size?


You can get the pixel dimensions easily in PHP (forget the details), but as above, in general there is no need to do this.

QUOTE

I will be using .png when I can otherwise I will use .gif format. Or, am I totally off base with my idea? Can anyone suggest a better way?


Either should be fine... In the old days I used PaintShopPro, which made it very easy with gifs to adjust exactly the colour palette being used. Now it seems to be much harder to see what's going on, but I suppose that's called "progress".
CharlesEF
Thanks for the information, I have found the php getimagesize() command which should do what I need. The actual file size is small, average of about 250KB.


Thanks for the help,

Charles
Brian Chandler
QUOTE(CharlesEF @ Sep 19 2013, 12:49 AM) *

Thanks for the information, I have found the php getimagesize() command which should do what I need. The actual file size is small, average of about 250KB.


But a small flag of Japan (for example) ought to fit in around 200 bytes: see the top of this page...
http://imaginatorium.org/shop/shop.htm

So why do modern systems take 1000 times as much space? Really, quite some progress...
CharlesEF
I might be wrong but I start with a large version of the flag and then reduce it to fit in the space I want. I think I retain as much of the detail as I can this way.

At least that's what I think. Also, I might have overstated the file size since I was not using my laptop at the time and could not check the actual sizes.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.