Copy and resize png image in PHP
Description
The following code shows how to copy and resize png image.
Example
<?php/*from w w w . j av a 2s. co m*/
header("content-type: image/png");
$src_img = imagecreatefrompng("test.png");
$srcsize = getimagesize("test.png");
$dest_x = $srcsize[0] / 1.5;
$dest_y = $srcsize[1] / 1.5;
$dst_img = imagecreatetruecolor($dest_x, $dest_y);
imagecopyresized($dst_img, $src_img, 0, 0, 0, 0,$dest_x, $dest_y, $srcsize[0], $srcsize[1]);
imagepng($dst_img);
imagedestroy($src_img);
imagedestroy($dst_img);
?>
The code above generates the following result.