Page 1 of 1

Resizing images to make them look good smaller

Posted: Sun Jul 08, 2007 1:45 am
by pinehead18
Ok, so i have a site where you can upload pretty much any size image. However, i write a script that pulls from random images and i just said "width and height". this makes the images look like crap.

How can i make it so it resizes to the correct size so it doesn't look like crap?


Thanks

Posted: Sun Jul 08, 2007 6:41 am
by miro_igov
Use getimagesize http://www.php.net/manual/en/function.getimagesize.php

Then calculate the ratio by defining max height and width and resample the image with http://www.php.net/manual/en/function.i ... ampled.php

Posted: Sun Jul 08, 2007 7:00 am
by superdezign
Use getimagesize() during display or imagecopyresampled() after the upload.