try this using this script:
if(isset($_GET['s'])){
$filename = $_SERVER['DOCUMENT_ROOT'].$_GET['s'];
}
$file = getimagesize($filename);
$width = $file[0];
$height = $file[1];
$dst_w = 300;
$dst_ht = 300;
$src_x = ($width - $dst_w) / 2;
$src_y = ($height - $dst_h) / 2;
// Resample and resize based on file extention
if($file['mime'] == "image/jpeg"){
$dst_image = imagecreatetruecolor($dst_w, $dst_h);
$src_image = imagecreatefromjpeg($filename);
imagecopyresampled($dst_image, $src_image, 0, 0, $src_x, $src_y, $dst_w, $dst_h, $width, $height);
header('Content-type: image/jpeg');
imagejpeg($dst_image, null, 100);
}elseif($file['mime'] == "image/png"){
$dst_image = imagecreatetruecolor($dst_w, $dst_h);
$src_image = imagecreatefrompng($filename);
imagecopyresampled($dst_image, $src_image, 0,0, $src_x, $src_y, $dst_w, $dst_h, $width, $height);
header('Content-type: image/png');
imagepng($dst_image);
}elseif($file['mime'] == "image/gif"){
$dst_image = imagecreatetruecolor($dst_w, $dst_h);
$src_image = imagecreatefromgif($filename);
imagecopyresampled($dst_image, $src_image, 0, 0, $src_x, $src_y, $dst_w, $dst_h, $width, $height);
header('Content-type: image/gif');
imagegif($dst_image);
}
you may have to play around with it a bit.
this supports, jpg, png, and gif
the script can take a while to run if your source image is large. on my site, a 2.7 MB jpg took about 5-6 seconds to render. however, works fast with smaller images, so i would make sure your images are not too large.
save this in make_thumb.php
to call use:
<img src="www.yoursite.com/make_thumb.php?s=path/to/your/image.jpg" />
hope this helps