("Content-type: image/jpeg");
$image = $_GET['img'];
if(!isset($w) && !isset($h)){
$w = 100; //default width if $w is not set
$h = 125; //default height if $h is not set
}
$x = @getimagesize($image);// get image size
$sw = $x[0];// width
$sh = $x[1];// height
$im = @ImageCreateFromJPEG ($image) or // Read JPEG Image
$im = false; // If image is not JPEG
$w = 100; //default width if $w is not set
$h = 125; //default height if $h is not set
}
$x = @getimagesize($image);// get image size
$sw = $x[0];// width
$sh = $x[1];// height
$im = @ImageCreateFromJPEG ($image) or // Read JPEG Image
$im = false; // If image is not JPEG
if (!$im)
readfile($image);// return the actual message if error occurs.
else {
// Create the resized image destination
$thumb = @ImageCreateTrueColor ($w, $h);
// Copy from image source, resize it, and paste to image destination
@ImageCopyResampled ($thumb, $im, 0, 0, 0, 0, $w, $h, $sw, $sh);
// Output resized image
@ImageJPEG ($thumb);
}
?>
No comments:
Post a Comment