Page 1 of 1

Cut the rose with PHP help

Posted: 2012-03-24T02:16:11-07:00
by myspacee
Hello,
at job we have modify a PHP that allow to our user to upload->crop an image

with floating area user can select a small portion of image and then commit cut.
Final result is a txt file with some info that are parsed from a script that do things.

one of thing to do is cut select area, post an image to explain our goal:

Image

Our PHP return 4 usefull info, coord for point A and point B. From these we can obtain also C and D coordinates.

Now, how i can script a cut that return my roses in right way ?

thank you for any info,
m.

Re: Cut the rose with PHP help

Posted: 2012-03-24T04:39:36-07:00
by Bonzo
So the values for A and B are in a text file; these are being read into php variables

If so you need to seperate the two values within A and B then:

Code: Select all

$width = Bx-Ax;
$height = By-Ay;
exec("convert rose -crop +$widthx+$height$Ax+$Ay output.jpg");