View previous topic :: View next topic |
Author |
Message |
merolen Newbie
Joined: 29 Jul 2007 Posts: 2
|
Posted: Sun Jul 29, 2007 10:24 am Post subject: Set inital sx,sy,ex,ey cords for the cropping window |
|
|
Hi!
As so many before me I have to say that the CropCanvas project is so great! The best part is that it's easy to understand and use.
But now to the question:
You have the Code: | $ci->setCropPositionDefault(ccCENTRE); | where you can insert the initial crop window-position. But is there any way to make it take the sx,sy,ex,ey coordinates so I can choose exactly the crop-window?
I'm storing the coordinates in a DB and when I bring back an image I use the original and not the cropped. But I want the crop-window to be placed where I cropped the image. Maybe not easy to get that one.. But hope you understood
Again thanks for a great project/script! |
|
Back to top |
|
 |
amnuts Site Admin

Joined: 01 Sep 2002 Posts: 662 Location: East Sussex, England
|
Posted: Sun Jul 29, 2007 3:07 pm Post subject: |
|
|
Hi, and welcome to the board.
By default. no, there isn't a way to do that. However, the initial width/height and position of the cropping area is done in the inc.cropjavascript.php file, with these two lines:
Code: | list($w, $h) = $this->calculateCropDimensions($this->crop['default']);
list($x, $y) = $this->calculateCropPosition($w, $h); |
So you could just put something in place of that to get the data from the DB and populate the $x and $y variables (and $w/$h if they are stored, too). Possibly a good idea to default to the above method if the DB cannot be connected to or the data not retrieved for some reason.
Andy |
|
Back to top |
|
 |
merolen Newbie
Joined: 29 Jul 2007 Posts: 2
|
Posted: Wed Aug 01, 2007 9:12 am Post subject: Thanks! |
|
|
Thank you.
It works! Wasn't that difficult to make. It's been very easy to work with your script
for anyone who is curious about how it's done:
Code: |
$w = $ex - $sx;
$h = $ey - $sy;
$x = $sx;
$y = $sy;
|
In stead of:
Code: |
list($w, $h) = $this->calculateCropDimensions($this->crop['default']);
list($x, $y) = $this->calculateCropPosition($w, $h);
|
Again thanks and keep up the great work! |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|