andy's php projects
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Script and site usage:
All of the scripts on this site are provided free for non-commerical, personal or non-profit use. If you find these scripts useful to you, appreciate the free support, or are just an all round nice person, then why not donate a little dosh? If you wish to use any of these in a commercial system, please refer to the payment plan.


Set inital sx,sy,ex,ey cords for the cropping window

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Crop Canvas
View previous topic :: View next topic  
Author Message
merolen
Newbie


Joined: 29 Jul 2007
Posts: 2

PostPosted: Sun Jul 29, 2007 10:24 am    Post subject: Set inital sx,sy,ex,ey cords for the cropping window Reply with quote

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 Smile

Again thanks for a great project/script!
Back to top
View user's profile Send private message
amnuts
Site Admin


Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Sun Jul 29, 2007 3:07 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
merolen
Newbie


Joined: 29 Jul 2007
Posts: 2

PostPosted: Wed Aug 01, 2007 9:12 am    Post subject: Thanks! Reply with quote

Thank you.

It works! Wasn't that difficult to make. It's been very easy to work with your script Very Happy

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Crop Canvas All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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