You can use the GD module or the ImageMagick module to resize and shrink any uploaded images.
If you google around for something like "PHP image resizer", you'll find lots of examples. I tend to use GD, as I have an old bit of code kicking around that works just fine. Assuming you have a known uploaded jpeg image found at $srcImgPath
, you could do something like the following, where $newWidth
and $newHeight
are the new sizes of image you want:
list($width, $height, $type) = getimagesize($srcImgPath);
$srcImg = imagecreatefromjpeg($srcImgPath);
if ($srcImg === false) return false;
$workImg = imagecreatetruecolor($newWidth,$newHeight);
imagecopyresampled($workImg,$srcImg,0,0,0,0,$newWidth,$newHeight,$width,$height);
imagejpeg($workImg,$newFilename,$quality);
Functionalize as appropriate, and be sure to specify the $quality
. You can abstract this code out to handle gifs and pngs very easily as well.