Вам нужна функция imagecopyresampled
, которая также интерполирует пиксели (imagecopyresized этого не делает);
В моем коде я использую его в такой функции:
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
и $destination
являются путями к именам файлов