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
Resizing images to make them look good smaller
Moderator: General Moderators
-
pinehead18
- Forum Contributor
- Posts: 329
- Joined: Thu Jul 31, 2003 9:20 pm
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
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
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Use getimagesize() during display or imagecopyresampled() after the upload.