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. Quote Link to comment 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.