и сам код скрипта, пример можно сказать хрестоматийный...
      foreach ($_REQUEST as $key=>$value) {
              $$key=$value;
      }//foreach
     function LoadJpeg($imgname) {
               $im = @imagecreatefromjpeg ($imgname);
               if (!isset($im)) {
                   $im  = imagecreate (150, 30);
                   $bgc = imagecolorallocate ($im, 255, 255, 255);
                   $tc  = imagecolorallocate ($im, 0, 0, 0);
                   imagefilledrectangle ($im, 0, 0, 150, 30, $bgc);
                   imagestring ($im, 1, 5, 5, "Error loading $imgname", $tc);
               }
               return $im;
     }//function
     $max_width = $w;
     $max_height = $h;
      $size = GetImageSize($image);
      $width = $size[0];
      $height = $size[1];
      $x_ratio = $max_width / $width;
      $y_ratio = $max_height / $height;
      if (($width <= $max_width) && ($height <= $max_height) ) {
          $tn_width = $width;
          $tn_height = $height;
      }
      elseif (($x_ratio * $height) < $max_height) {
          $tn_height = ceil($x_ratio * $height);
          $tn_width = $max_width;
      }
      else {
          $tn_width = ceil($y_ratio * $width);
          $tn_height = $max_height;
      }
      $src = LoadJpeg($image);
      $dst = ImageCreateTrueColor($tn_width,$tn_height);
      ImageCopyResized($dst, $src, 0, 0, 0, 0,$tn_width,$tn_height,$width,$height);
     header("Content-type: image/jpeg");
     ImageJpeg($dst, null, -1);
     ImageDestroy($src);
     ImageDestroy($dst);
?>