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.


It doesn?t work to me

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


Joined: 11 Apr 2005
Posts: 3

PostPosted: Mon Apr 11, 2005 10:38 am    Post subject: It doesn?t work to me Reply with quote

Hi ppl, sorry about my english, i?m portuguese and i?m trying to make a news section of a website and i need the crop canvas to work in way to resize and crop the images to news section, i need something that allows me to upload a picture, resize it and crop, and then save to a folder, i?ve searched in the forum and i found some examples but none of them worked to me, i don?t know why, does anyone have some example with the files that can sent me? thanks a lot!!! [[ ]]
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 Apr 11, 2005 10:53 am    Post subject: Reply with quote

Hi, and welcome to the board!

The example file, test.cropinterface.php, should provide the basics on how to get the cropping tool to work. Basically you need to download all of the files in the project folder. The interface is jsut a 'plug into your own system' kind of thing and doesn't come with an interface to upload, etc., butyou should be able to find thousands of examples on how to do that just by a quick search in Google, or your favourite search engine. A good place to start is the PHP manual.

Other than that; you say it doesn't work for you... What have you tried? What errors does it display on screen or put into the php error log?

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


Joined: 11 Apr 2005
Posts: 3

PostPosted: Mon Apr 11, 2005 11:20 am    Post subject: Reply with quote

i found now that one of the problems was the gd version...now it gives the file i think...i will look for a method to save it to disk, thanks Smile
Back to top
View user's profile Send private message
crxvtec
Newbie


Joined: 11 Apr 2005
Posts: 3

PostPosted: Mon Apr 11, 2005 12:04 pm    Post subject: Reply with quote

Notice: Undefined variable: position in c:\inetpub\wwwroot\arq\3\class.cropcanvas.php on line 270

Error in function saveImage: That file cannot be saved with the function 'image'.


i?m trying to save the pic to disk and i get this error, do you know how to solve it?

the code i?m using:

<?php

require_once 'class.cropinterface.php';
$ci = new cropInterface(true);

if ($_GET['file'])
{
$ci->loadImage($_GET['file']);
$ci->cropToDimensions($_GET['sx'], $_GET['sy'], $_GET['ex'], $_GET['ey']);
//header('Content-type: image/jpeg');
//$ci->showImage('jpg', 100);
$test = realpath("mypicture.jpg");
$ci->saveImage($test, 80);

exit;
}
?>


the link i?m using:

http://localhost/arq/3/test.cropinterface.php?file=ya.jpg&sx=312&sy=186&ex=468&ey=288


thanks
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 Apr 12, 2005 3:01 am    Post subject: Reply with quote

crxvtec wrote:
Notice: Undefined variable: position in c:\inetpub\wwwroot\arq\3\class.cropcanvas.php on line 270


This notice can be tidied up by the method used in this thread:

http://php.amnuts.com/forums/viewtopic.php?t=53&highlight=undefined

crxvtec wrote:
Error in function saveImage: That file cannot be saved with the function 'image'.


Now this is a little trickier... What the saveImage method attempts to do is extract the file extension from the file name you pass as the first parameter. It then uses this to construct the function name; imagejpeg, imagepng, etc. The error being shown suggests that the filename doesn't have an extension on the end of it. The reason for that is this line that you're using:

crxvtec wrote:
$test = realpath("mypicture.jpg");


If the realpath function cannot find the file that you pass to it then it will return false. As 'mypicture.jpg' doesn't exist, because you haven't saved it yet, then $test will have the value false, and not the path to the local directory as you intend. You are better off to use something like:

PHP:
<?php $test dirname(__FILE__) . '/mypicture.jpg'?>


or:

PHP:
<?php $test realpath('.') . 'mypicture.jpg'?>


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