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, what?s wrong?

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


Joined: 09 Nov 2004
Posts: 6

PostPosted: Tue Nov 09, 2004 5:54 am    Post subject: It doesn?t work, what?s wrong? Reply with quote

Hello!

We have a community, and we need a script so users can upload their photos and crop a area, save and send it to us.

This script (Crop Canvas) seems perfect for this, but it doesn?t work. I don?t know what is wrong. We use IIS on Win2000, and I installed latest PHP on it.

Here is the link: http://www.albastorm.com/php-crop/test.php

I checked the script (class file), there is no free space (white space before <? and ?> )

Can anyone help me?

Note: I?m a newbie on PHP Embarassed
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 Nov 09, 2004 7:39 am    Post subject: Reply with quote

Hi, and welcome to the board!

It's not working because you're getting notice wanrings which are sending text/html header, so then when the image tries to display it can't output the image headers.

Quick way to fix this is to turn off the notice wanrings for this script.

At the top of your test script, before anything else, put this line of PHP:

PHP:
<?php error_reporting (E_ALL E_NOTICE); ?>


So taking the default example, the top of your file might look like:

PHP:
<?php

    error_reporting 
(E_ALL E_NOTICE);
    require_once 
'class.cropinterface.php';
    
$ci = new cropInterface();
    
    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);
        exit;
    }

?>


The slightly more correct way to fix this is by updating the class to remove the notice inducing elements. Something which I need to do to all my scripts!

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


Joined: 09 Nov 2004
Posts: 6

PostPosted: Wed Nov 10, 2004 2:58 am    Post subject: Can?t save croped image! Reply with quote

Hi Andy, many thanx for your help.
I did like you said and now it works better, but when I crop the image it doesn?t show (save) the croped image.

Here is the link: http://www.albastorm.com/php-crop/test.cropinterface.php
Back to top
View user's profile Send private message
amnuts
Site Admin


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

PostPosted: Wed Nov 10, 2004 5:47 am    Post subject: Reply with quote

Hi,

To be honest, just running it wont help see what the problems are. So here are a couple things your can try. First, turn on debugging. You can do this by sending 'true' as a parameter when you instantiate the class.

PHP:
<?php $ci = new cropInterface(true); ?>


If that doesn't give you some idea, then post up the code you're using and let's see if we can help you out with 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
arhq
Newbie


Joined: 23 Dec 2004
Posts: 1

PostPosted: Thu Dec 23, 2004 10:06 pm    Post subject: also does not work! Reply with quote

i met the same problem.
and i'v tried the two advices above, but it also does not work Sad
my link is: http://westbrae.net/crop/index.php

here is the modified code of "test.cropinterface.php" according to yr first advice:
Code:
<?php
   error_reporting (E_ALL ^ E_NOTICE);
   
   require_once 'class.cropinterface.php';
   $ci = new cropInterface();
   
   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);
      exit;
   }

?>

<html>

<head>
   <style type="text/css">
      body, td, p
      {
         font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
         font-size: 10px;
      }
      
      #submit
      {
         font-size: 10px;
         font-family: "MS Sans Serif", Geneva, sans-serif;
         height: 23px;
         background-color: #D4D0C8;
         border: 0px;
         padding: 3px,5px,3px,5px;
         width: 100%;
      }
   </style>
</head>
<body>

   <?php

      $ci->loadInterface('girl.jpg');
      $ci->loadJavaScript();

   ?>

</body>
</html>

this does NOT work!


and if i took the second advice, the code is:
Code:
<?php
   error_reporting (E_ALL ^ E_NOTICE);
   
   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);
      exit;
   }

?>

<html>

<head>
   <style type="text/css">
      body, td, p
      {
         font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
         font-size: 10px;
      }
      
      #submit
      {
         font-size: 10px;
         font-family: "MS Sans Serif", Geneva, sans-serif;
         height: 23px;
         background-color: #D4D0C8;
         border: 0px;
         padding: 3px,5px,3px,5px;
         width: 100%;
      }
   </style>
</head>
<body>

   <?php

      $ci->loadInterface('girl.jpg');
      $ci->loadJavaScript();

   ?>

</body>
</html>

i got the error like this:
Quote:
Error in function loadImage: That file cannot be loaded with the function 'imagecreatefromjpeg'.

Error in function cropToDimensions: The original image has not been loaded.


Warning: Cannot modify header information - headers already sent by (output started at d:\wwwroot\arhqu\wwwroot\crop\class.cropcanvas.php:503) in d:\wwwroot\arhqu\wwwroot\crop\index.php on line 11

Error in function showImage: There is no processed image to show.


omg Crying or Very sad
Back to top
View user's profile Send private message Visit poster's website
amnuts
Site Admin


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

PostPosted: Fri Dec 24, 2004 11:18 am    Post subject: Reply with quote

Hi arhq, and welcome to the board!

The fix you're looking for is actually shown on this thread:

http://php.amnuts.com/forums/viewtopic.php?t=129

It's about the 9th post down, and concerns $_SERVER['DOCUMENT_ROOT'].

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