php Thumb nail script help

dharmil

New Member
Messages
1,656
Reaction score
0
Points
0
i need help with this thumbnail script

to view the thumnail you go to thumbnail.php?image=http://domain.com/images/image.jpg
but for some reson it doent thumb nail the image

PHP:
<?php
$image = $HTTP_GET_VARS['image'];

list($widthreal, $heightreal, $type, $attr) = getimagesize("$image");

$size = getimagesize($image);
$width = $size[0];
$height = $size[1];

$width = $width-$widthreal;

$height = $height-$heightreal;

$x = $width/2;
$y = $height/2;
if ($type == '2')
{
$src = imagecreatefromjpeg($image);
}
elseif ($type == '1')
{
$src = imagecreatefromgif($image);
}
elseif ($type == '3')
{
$src = imagecreatefrompng($image);
}

$tmb = imagecreatetruecolor($widthreal,$heightreal);

imagecopy($tmb, $src, 0, 0, $x, $y, $widthreal, $heightreal);
if ($type == '2')
{
header('Content-type: image/jpeg');
imagejpeg($tmb, null, 100);
}
elseif ($type == '1')
{
header('Content-type: image/gif');
imagegif($tmb, null, 100);
}
elseif ($type == '3')
{
header('Content-type: image/png');
imagepng($tmb, null, 100);
}
imagedestroy($src);
imagedestroy($tmb);
imagedestroy($thumb);
?>
to view the thumnail you go to thumbnail.php?image=http://domain.com/images/image.jpg
but for some reson it doent thumb nail the image
 
Last edited:

oab

New Member
Messages
918
Reaction score
0
Points
0
why dont you post it here so we can all learn from it??
 
Top