<?php
header ("Content-type: image/jpeg");
$pic = 'ship.jpg';
$max_height = 1000;
$max_width = 1000;
$picinfo = getimagesize($pic);
$width = $picinfo[0];
$height = $picinfo[1]; 
$widthratio = $width/$max_width;
$heightratio = $height/$max_height;
if ($widthratio > $heightratio){
    $ratio = $widthratio;
}
if ($heightratio > $widthratio){
    $ratio = $heightratio;
}
$newwidth = $width/$ratio;
$newheight = $height/$ratio;
$src_img = imagecreatefromjpeg($pic);
$thumb = imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($thumb,$src_img,0,0,0,0,$newwidth,$newheight,$width,$height);
imagejpeg($thumb);
?>







