It is necessary to reduce the image proportionally, but, specifying only its width, and the height to be determined automatically, based on the size of the width. Is it possible?
$src = imagecreatefrompng($iii); $img = getimagesize($iii); $width = $img[0]; $height = $img[1]; $resize_width = ($width*50)/100; $resize_height = ($height*50)/100; $new = ImageCreateTrueColor($resize_width,$resize_height); imagealphablending($new, false); imagesavealpha($new, true); ImageCopyResampled($new, $src, 0, 0, 0, 0, $resize_width, $resize_height, $width, $height); imagepng($new, './img'.p($_POST['title']).'.png', 9, PNG_ALL_FILTERS); imagedestroy(array($img,$src,$new));
ImageCopyResampled($new, $src, 0, 0, 0, 0, $resize_width, $resize_height, $width, $height);
for example, you can specify not $resize_height
but auto
but not so)