Hi all ,
what i want to do is to resample my large image into smaller resolution image and save it on the server, but the output image is corrupted when i open it in windows image viewer
:(:(
please help me , here is the code .
// The file
$filename = 'd.png';
$percent = 0.5;
// Content type
// Get new dimensions
list($width, $height) = getimagesize($filename);
$new_width = 400;
$new_height = 400;
// Resample
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefrompng($filename);
imagealphablending($im_dest, false);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagesavealpha($image_p, true);
// Output
imagepng($image_e,'aa.png',0);
the output image is attached too ,