Jump to content

Crop Image Help


TFD3

Recommended Posts

Hi

 

I have a image:

http://farm3.static.flickr.com/2101/2513017560_709909f068_o.jpg

that I need to crop to get only the radar image to show up.

 

I am using this script:

 

<?php
$w=$_GET['w'];
$h=isset($_GET['h'])?$_GET['h']:$w;    // h est facultatif, =w par défaut
$x=isset($_GET['x'])?$_GET['x']:0;    // x est facultatif, 0 par défaut
$y=isset($_GET['y'])?$_GET['y']:0;    // y est facultatif, 0 par défaut
$filename=$_GET['src'];
header('Content-type: image/jpg');
header('Content-Disposition: attachment; filename='.$src);
$image = imagecreatefromjpeg($filename); 
$crop = imagecreatetruecolor($w,$h);
imagecopy ( $crop, $image, 0, 0, $x, $y, $w, $h );
imagejpeg($crop);
?>

 

To use the script, use this URL:

http://www.alabamaweather.org/gr2ae/images/gr2ae.php?x=10&y=20&w=30&h=40&src=gr2ae.jpg

 

But when I use the above URL it wants me to download a file instead of displaying the cropped image.

 

?????

 

 

 

Kenny

 

Link to comment
https://forums.phpfreaks.com/topic/106715-crop-image-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.