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.


Fatal error: Call to undefined method

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


Joined: 22 Oct 2006
Posts: 7

PostPosted: Sun Oct 22, 2006 10:09 pm    Post subject: Fatal error: Call to undefined method Reply with quote

Hello there. Sorry my poor english, but I really need help here.

I've just uploaded the class files into the server, then I created 3 php files just copying this post first (didn't rok) and second example (didn't work too): http://php.amnuts.com/forums/viewtopic.php?t=191

So, I got the "config.php", "upload.php" and "crop.php" and uploaded into de class folder in the server as well.
The I ran upload.php file, selected the image and uploaded it (the first time it reaaly uploaded it, but after, it didn't work). Then, it goes to the crop.php (wich calls the crop class) and the image is not there (just an X with the right image size) and this message at the bottom:

Fatal error: Call to undefined method CropInterface::loadJavaScript() in "mysitepath"/cropcanvas/crop.php on line 46

So, if I click on "crop the image" button, nothing happens but a blank IE screen.

I'm really PHP newbie but I really need a script that upload an image, crop it and then save it again in the server. Can you help to create a PHP system that works properlly?

Thank you very much!
Cheers
Back to top
View user's profile Send private message
amnuts
Site Admin


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

PostPosted: Mon Oct 23, 2006 9:57 am    Post subject: Reply with quote

Hi,

No need to apologize about your English! I thought you were perfectly understandable and you can speak English better than a lot of English people I know!! Smile

The problem you're having is that you're using a new version of the cropping class (and interface class) but are trying to mix it with the old way the class used to work (as it was in the upload thread you pointed to). The crop.php file is the only one you'd need to change, and it should be something like this:

Code:
<?php

    require_once('config.php');
    require_once('class.cropinterface.php');
    $ci =& new CropInterface();
   
    if (isset($_GET['file']) && isset($_GET['sx'])) {
        $ci->loadImage($_GET['file']);
        $ci->cropToDimensions($_GET['sx'], $_GET['sy'], $_GET['ex'], $_GET['ey']);
        $ci->saveImage(CROP_DIR . $_GET['file']);
        header('Content-type: image/jpeg');
        $ci->showImage('jpg', 90);
        exit;
    }

?>

<html>

<body>

    <?php $ci->loadInterface(UPLOAD_DIR . $_GET['file']); ?>

</body>
</html>


The loadInterface function call comes from the crop interface file, and at that point (before the loadInterface call) you can set other parameters for the interface. To see some examples, check out the code and comments in class.cropinterface.php or test/cropinterface.php.

This portion:

Code:
        $ci->saveImage(CROP_DIR . $_GET['file']);
        header('Content-type: image/jpeg');
        $ci->showImage('jpg', 90);
        exit;


Is just an example of what to do and uses the main cropping class, which can be found in class.cropcanvas.php. Again, check out the comments/code for more examples.

Andy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
edubrouks
Newbie


Joined: 22 Oct 2006
Posts: 7

PostPosted: Mon Oct 23, 2006 12:31 pm    Post subject: Reply with quote

Hello! thank you very much, now there's no script error!

Well, but I still have a problem. I can upload an image but it don't display in crop screen. I got a missing image style box with the size of the image I've uploaded. I noticed in the server that images inside de uploaded folder that I've created have CHMODE 600 and I don't have permission to change it... can this be the problem? Why the images uploaded by the upload.php make it?

Thanx a lot, bye!
Back to top
View user's profile Send private message
edubrouks
Newbie


Joined: 22 Oct 2006
Posts: 7

PostPosted: Mon Oct 23, 2006 12:48 pm    Post subject: Reply with quote

PS: when I crop the missing picture, I got this

Warning: imagejpeg() [function.imagejpeg]: Unable to open '/home/restricted/home/dezviagens/public_html/cropcanvas/cropped//home/restricted/home/dezviagens/public_html/cropcanvas/uploaded/alter.jpg' for writing in /home/restricted/home/dezviagens/public_html/cropcanvas/class.cropcanvas.php on line 204
JFIF;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 90 C     C   Om" ĵ}!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz.....

And there's nothing inside the "cropped" folder in the server. Ok? Just to help to figure out what's happening. Bye, cheers!
Back to top
View user's profile Send private message
amnuts
Site Admin


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

PostPosted: Mon Oct 23, 2006 2:05 pm    Post subject: Reply with quote

edubrouks wrote:
'/home/restricted/home/dezviagens/public_html/cropcanvas/cropped//home/restricted/home/dezviagens/public_html/cropcanvas/uploaded/alter.jpg'


This is your problem; that path is more than likely wrong. It probably should only have one instance of this in there:

Code:
/home/restricted/home/dezviagens/public_html/cropcanvas/uploaded/


What's your config.php file look like?

Andy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
edubrouks
Newbie


Joined: 22 Oct 2006
Posts: 7

PostPosted: Mon Oct 23, 2006 8:09 pm    Post subject: Reply with quote

Hello Andy. Here's like my config.php looks like

<?php
define('BASE_DIR', dirname(__FILE__) . '/');
define('UPLOAD_DIR', BASE_DIR . 'uploaded/');
define('CROP_DIR', BASE_DIR . 'cropped/');
?>

But I tried this

<?php
define('BASE_DIR', dirname(__FILE__) . '/');
define('UPLOAD_DIR', BASE_DIR . '/home/restricted/home/dezviagens/public_html/cropcanvas/uploaded/');
define('CROP_DIR', BASE_DIR . '/home/restricted/home/dezviagens/public_html/cropcanvas/uploaded/');

And it doesn't work as well. I got this message:

Warning: move_uploaded_file(/home/restricted/home/dezviagens/public_html/cropcanvas//home/restricted/home/dezviagens/public_html/cropcanvas/uploaded/default.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/restricted/home/dezviagens/public_html/cropcanvas/upload.php on line 11

I can't understand wha'ts happening!
Thax a lot
Bye
?>
Back to top
View user's profile Send private message
amnuts
Site Admin


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

PostPosted: Tue Oct 24, 2006 3:32 am    Post subject: Reply with quote

What the dirname(__FILE__) code does is returns the full path that the file containing that line is in. So what you're doing is adding your full path to your full path. If you don't want to use that, then do something like this:

Code:
<?php

define('UPLOAD_DIR', '/home/restricted/home/dezviagens/public_html/cropcanvas/uploaded/');
define('CROP_DIR', '/home/restricted/home/dezviagens/public_html/cropcanvas/uploaded/');

?>
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
edubrouks
Newbie


Joined: 22 Oct 2006
Posts: 7

PostPosted: Tue Oct 24, 2006 7:31 am    Post subject: Reply with quote

Hello Andy. Thank you very much for your patience.
Well, it didn't work again. I think there's some need of changes in the others files too. I did what you said in config.php but I the crop screen still not displaying the image and if I crop it I got it:

Warning: imagejpeg() [function.imagejpeg]: Unable to open '/home/restricted/home/dezviagens/public_html/cropcanvas/cropped//home/restricted/home/dezviagens/public_html/cropcanvas/uploaded/picture.jpg' for writing in /home/restricted/home/dezviagens/public_html/cropcanvas/class.cropcanvas.php on line 204
JFIF;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 90 C     C  

I saw the path is reapeat... well I need to call the UPLOAD_DIR or CROP_DIR in the upload.php or crop.php?

Thanx again! Bye
Back to top
View user's profile Send private message
edubrouks
Newbie


Joined: 22 Oct 2006
Posts: 7

PostPosted: Wed Oct 25, 2006 1:18 pm    Post subject: Reply with quote

Hello again Andy. I've been trying to get the thing to work, but I can't understand wha'ts happening. The problem definitely (maybe) is the config.php

If I set the UPLOAD_DIR and CROP_DIR to /home/restricted/home/dezviagens/public_html/cropcanvas/uploaded, the upload.php work and really upload the image to the server, but in the crop screen I don't get the image, just its box. If I see its propreties I see the problem... the path show http://www.dezviagens.com.br/home/restricted/cropcanvas/uploaded/image.jpg... It wouldn't have the /home/restricted part in the path.. So I tried hard to change the config.php.. without th /home/restricted, with just /cropcanvas/uploaded... when the upload works, I always get a wrong path in the crop screen... and if I take out the /home/restricted in the config.php I get this message:

Warning: move_uploaded_file() [function.move-uploaded-file]: open_basedir restriction in effect. File(/cropcanvas/uploaded/image.jpg) is not within the allowed path(s): (/home/restricted/home/dezviagens:/tmp:/usr/share/pear) in /home/restricted/home/dezviagens/public_html/cropcanvas/upload.php on line 11
There was an error uploading that file.Array ( [image] => Array ( [name] => image.jpg [type] => image/pjpeg [tmp_name] => /home/restricted/home/dezviagens/tmp/phpRlaAth [error] => 0 [size] => 31319 ) )

So that's it... I'm confuse, almost killing myself on it! ehehe Please, help me and thanx a lot
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