Page 1 of 1

Crop Photo

Posted: Wed Aug 09, 2006 3:13 am
by Mr Tech
I'm trying to create a crop photo script... I found this which works:

Code: Select all

$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);
However what I'm trying to do is save the cropped photo somewhere on the server instead of downloading it... Any ideas on how I could acheive this?

Posted: Wed Aug 09, 2006 8:25 am
by feyd
imagejpeg() along with all the other image output functions have an argument for the filename you wish to save it as.