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.


Crop using ratio

 
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
darkisolde
Newbie


Joined: 11 Aug 2005
Posts: 2

PostPosted: Thu Aug 11, 2005 4:50 pm    Post subject: Crop using ratio Reply with quote

Hello

I followed your step by step of this post:

http://php.amnuts.com/forums/viewtopic.php?t=107&highlight=ratio

and if I use this code to have dynamic version it don't allow me to move the crop box around because it seems that there is an error in this function:

Code:


function my_setSize()
{
   element = document.getElementById('setSize');
   if (element.value > 0)
   {
      dd.elements.theCrop.moveTo(dd.elements.theImage.x, dd.elements.theImage.y);
      switch(element.value)
      {

EOT;

foreach ($this->_cropSizes as $key => $size) {
    echo "case '$key':\n";
    echo "dd.elements.theCrop.resizeTo({$size[0][0]}, {$size[0][1]});\n";
    echo "dd.elements.theCrop.defw = {$size[0][0]};\n";
    echo "dd.elements.theCrop.defh = {$size[0][1]};\n";
    echo "break;\n";
}      

echo <<< EOT

      }
   }
}   



Could be because of EOT Confused when I tried to integrate PHP inside javascript?

I really tried but I can't find the problem, any help would be appreciated.

Regards,
Darki
Back to top
View user's profile Send private message
amnuts
Site Admin


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

PostPosted: Fri Aug 12, 2005 3:23 am    Post subject: Reply with quote

Hi, and welcome to the board!

I'm assuming this is only a snippet of the code, and the 'EOT;' that you show actually have an 'echo <<<EOT' before it, and the 'echo <<<EOT' you show have an 'EOT;' after it?

If you're using Firefox to test this out one, try using the javascript debugger to see if that's kicking up any errors. If you don't know how to do this, just type 'javascript:' for the url.

Also; have you definitely got something in the _cropSizes array? If not, and you don't have any error checking on the foreach loop, then this would cause an error in the output.

Once the page has loaded, have you done a simle 'view source' in your browser? You could do this and verify that the switch statement looks okay and doesn't have any errors in it.

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