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.


Cropping problem

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


Joined: 01 Jul 2005
Posts: 1

PostPosted: Fri Jul 01, 2005 4:32 am    Post subject: Cropping problem Reply with quote

Hello all,

I have a little problem with your code.
I'm getting my file uploaded but not cropped.
Can you take a look? t.i.a

PHP:
<?php require 'class.cropcanvas.php'?>


PHP:
<?php define('IMAGE_DIR''beelden/bestuur/'); ?>


PHP:
<?php $filename =  $_FILES['foto']['name'];
        if (
move_uploaded_file($_FILES['foto']['tmp_name'], IMAGE_DIR $filename)) 
        {            
            
$cc = new canvasCrop();
            if (
$cc->loadImage($filename))
            {
                
print_r("boe");
                
$cc->cropByPercent(15,50ccCENTER);
                
$file_to_upload "beelden/cropped/".$filename;
                
$cc->saveImage($file_to_upload); 
                
header('content-type:image/jpeg');
            }
            else
            {
                echo 
'There was an error cropping that file.';
            }            
        } 
        else 
        {
            echo 
'There was an error uploading that file.';
            
print_r($_FILES);
        } 
?>


PHP:
<?php $cc->flushImages(); ?>


thank you!!

ps. my php knowledge is not so good.
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 Jul 01, 2005 7:47 am    Post subject: Reply with quote

Hi, and welcome to the board!

The problem may be that you're only passing the file name to the loadImage method, rather than the full file path and name.

The snippet is question is:

PHP:
<?php $filename =  $_FILES['foto']['name'];
        if (
move_uploaded_file($_FILES['foto']['tmp_name'], IMAGE_DIR $filename))
        {            
            
$cc = new canvasCrop();
            if (
$cc->loadImage($filename)) ?>


Try this and see if it gives you better results:

PHP:
<?php $filename =  $_FILES['foto']['name'];
        if (
move_uploaded_file($_FILES['foto']['tmp_name'], IMAGE_DIR $filename))
        {            
            
$cc = new canvasCrop();
            if (
$cc->loadImage(IMAGE_DIR $filename)) ?>


If that still gives you problems, try defining the path from root, rather than relative to the directory the script is running in (which is how it looks to be working now).

Regards,

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