Using the imagecopyresized() Function
<?php
define("T_WIDTH", 100);
define("T_HEIGHT", 100);
$img = imagecreatefrompng("me.png");
$img_copy = imagecreate(T_WIDTH, T_HEIGHT);
$width = imagesx($img);
$height = imagesy($img);
imagecopyresized($img_copy, $img, 0, 0, 0, 0,
T_WIDTH, T_HEIGHT, $width, $height);
header("Content-type: image/png");
imagepng($img_copy);
?>
Related examples in the same category