00001 <?PHP 00002 if (substr($img, -4, 4) == ".jpg" or substr($img, -4, 4) == ".JPG") { 00003 header("Content-type: image/jpeg"); 00004 $src = imagecreatefromjpeg($img); 00005 } else if (substr($img, -4, 4) == ".png" or substr($img, -4, 4) == ".PNG") { 00006 header("Content-type: image/png"); 00007 $src = imagecreatefrompng($img); 00008 } 00009 if (!$src) die("Unable to locate src image at $src"); 00010 $out = imagecreatetruecolor($x2, $y2); 00011 imagecopyresampled($out, $src, 0, 0, 0, 0, $x2, $y2, $x, $y); 00012 imagejpeg($out); 00013 imagedestroy($out); 00014 ?>