hackalive Posted October 30, 2011 Share Posted October 30, 2011 Hi guys, I am after some GD/PHP code that selects out an area of a larger picture. It must use x1, y1 to x1, y2 rather than x1, y1 and then a dimension, that is it must use coordinates. It must then parse the selection to a php function, not sure how to do this, but one idea is for it to send the selection to a tmp folder then parse the new image file Any help is very much appreciated. Link to comment https://forums.phpfreaks.com/topic/250087-php-gd/ Share on other sites More sharing options...
hackalive Posted October 30, 2011 Author Share Posted October 30, 2011 Im using this code <?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); imagefilter($image, IMG_FILTER_GRAYSCALE); imagefilter($image, IMG_FILTER_CONTRAST, -100); imagecopy ( $crop, $image, 0, 0, $x, $y, $w, $h ); imagejpeg($crop); ?> problem is, its doing like a "zoom in" I need it to keep the aspect ratio. Any ideas how I can do this? Link to comment https://forums.phpfreaks.com/topic/250087-php-gd/#findComment-1283416 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.