Image resizing [Archive] - C Board

PDA

View Full Version : Image resizing


Jock
02-19-2002, 02:24 PM
Hi! i hjave a little maths problem.

I need to write a sript in PHP that allows users to upload images files, then have them displayed in thumbnails. This is easy.
However, i dont want the thumbnails to apear "squashed" or "stretched". This means i cant simply tell the image to be a certain size, not can i use a percentage. As some images will be bigger than others, this wouldn't work.

The size of the thiumbnail should be aroun 80 x 80 ish. Any ideas? For the first person to tell me how to do this, i will provide free webhosting!!

Govtcheez
02-19-2002, 02:30 PM
Why can't you use a percent?

If you have the pixel size of the original, fit the largest dimension to 80 pixels and adjust the other one by the same ratio.

alex
02-20-2002, 08:22 AM
Hi!

take a look at the ImageMagicks "montage" manual page, which is included in all major linux distributions. It can generate a thumbnail-picture of a directory with only a single command. As you are making thumbnails for the web, you should probably not generate them on-the-fly, but only once, if you change the contents of the directory with the hi-res pictures.

alex

Jock
02-20-2002, 01:48 PM
Thanks Alex. I'll have a look at that!!

Free hosting comming your way i think! :)