Page 1 of 1

how to crop image using gd ??

Posted: Tue Jan 09, 2007 6:29 pm
by PHPycho
First of all Hi to everybody......
I am again back with the new problem related to GD....
I have been given a task of image manipulation like cropping image.....

The scenario:
there are 4 input fields like x1,y1 ,x2,y2 for entering the starting point and the end point of croping of image. when the form is submitted then it should make a crop image on the /crop/ directory......

The problem:
I didnt got the idea ...of crop ...
I would be greatful if anybody help me in cropping images using four fields x1,y1,x2,y2..

Thank you in advance

Posted: Tue Jan 09, 2007 8:31 pm
by aaronhall
Hmmm, I wonder if you've searched google... check out imagecopyresampled()

Posted: Tue Jan 09, 2007 11:20 pm
by PHPycho
Finally i was able to resize the image using the following code
but unable to crop the image..plz guide me....

Posted: Wed Jan 10, 2007 4:10 am
by onion2k
All you need to do is create a new image (with imagecreate or imagecreatetruecolor ), and copy the area you want from the existing image to the new image using imagecopy. Easy.