When users input their images, their images are any size. I want to be able to resize all the images to a specific dimension. Is there a function that allows me to do that i
The function you need is imagecopyresampled, that also interpolate pixels, (imagecopyresized does not);
In my code I use a it in a function like this:
function resizeAndSavePhoto($original, $destination, $dest_width, $dest_height){
$photo = createImage($original);
$size = getimagesize($original);
$final_photo = imagecreatetruecolor($dest_width, $dest_height);
imagecopyresampled($final_photo, $photo,0,0,0,0,$dest_width, $dest_height, $size[0], $size[1]);
imagejpeg($final_photo, $destination, 100);
}
$orignal
and $destination
are filename paths