codice:
$imgname="test.jpg";
$dim=getimagesize($imgname);
$src_img=imagecreatefromjpeg($imgname);
$x=400;
$y=300;
$im=Imagecreatetruecolor($x,$y);
imagecopyresampled( $im, $src_img, 0, 0, 0 , 0, $x, $y, $dim[0], $dim[1]);
for ($i=1;$i<128;$i++){
	$colore=imagecolorallocatealpha($im, 255, 255, 255, $i);
	imagefilledrectangle($im, $i-1, 0, $i, $y, $colore);
	imagecolordeallocate($im, $colore);
}
header("content-type: image/jpeg");
imagejpeg($im,"",80);
imagedestroy($im);