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.


Error: The image cannot be displayed it contains errors

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


Joined: 15 Feb 2005
Posts: 1

PostPosted: Tue Feb 15, 2005 4:13 pm    Post subject: Error: The image cannot be displayed it contains errors Reply with quote

I get this message when I try and crop the image loaded:

The image ?http://inquisive.com/control/crop/test.cropinterface.php?file=tiff.jpg&sx=0&sy=0&ex=162&ey=101? cannot be displayed, because it contains errors.

I thought it may be because I was running the script on my mac, but I get the same thing on my web server as listed above.

The url is:
http://www.inquisive.com/control/crop/test.cropinterface.php

Any ideas what the problem may be?
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 Feb 16, 2005 3:55 am    Post subject: Reply with quote

Hi atlbubba, and welcome to the board!

The problem you're getting could stem from one or two problems. It would be easier to determine if we could see the code you're using once the form is submitted. If you've got lots of extra code around it, just supply the section of code to do with the cropping.

Also, you may want to try turning on debugging to see if that gives you any error messages. You can do this by passing 'true' as a parameter when instantiating the class.

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


Joined: 13 Jan 2005
Posts: 3
Location: Mexico

PostPosted: Tue Jul 05, 2005 5:06 pm    Post subject: Reply with quote

I have the exact same problem. And I cannot find the variable that holds or displays such error message. The strange thing is that it displays the error in my native language, spanish. spooky. Anyway let me post the code. Any help would be appreciated!

Code:

if (@$_GET['file'])
   {
       $ci->loadImage($_GET['file']);
       $ci->cropToDimensions($_GET['sx'], $_GET['sy'], $_GET['ex'], $_GET['ey']);
      header('Content-type: image/jpeg');      
      $url_img = explode('/', $_REQUEST['file']);
      $img_name = count($url_img);
      $image = $url_img[$img_name-1];
      $img = explode('.', $image);
      $img[0].= "_thu.jpg";
      $ci->saveImage("../imagenes_db/".$img[0], 100);
      echo "<script language=\"javascript\"> window.close(); </script>";
      exit;
   }
[...]
<?php
   
      $img_name_array = explode('/', $_REQUEST["url"]);
      $x = count($img_name_array);
      $img_name = $img_name_array[$x-1];//image name
      $dir = "../imagenes_db/";      
      $ci->loadInterface($dir.$img_name);
      $ci->loadJavaScript();

   ?>


Here I do all the stuff then I want to close the window, on IE works, becasue it closes the window before the error can be displayed but on Firefox 1.0.4 it doesn't close the window and it displays that horrible error. The strange thing is that when I look at the source I cannot see the error printed in the source code.

If you need any more code, please tell me Very Happy thanks for an awesome class man!!
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
amnuts
Site Admin


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

PostPosted: Tue Jul 05, 2005 5:23 pm    Post subject: Reply with quote

Hi there,

The error isn't generated by the class, but rather it's either from your web server or your browser (most likely the browser), which is why you see it i you naitive language.

Your problems comes because you're sending the header to be a jpg, but then you're not actually sending any jpg content, but rather text/html in the form or a javascript command.

Try this:

PHP:
<?php if (@$_GET['file'])
   {
       
$ci->loadImage($_GET['file']);
       
$ci->cropToDimensions($_GET['sx'], $_GET['sy'], $_GET['ex'], $_GET['ey']);
      
$url_img explode('/'$_GET['file']);
      
$img_name count($url_img);
      
$image $url_img[$img_name-1];
      
$img explode('.'$image);
      
$img[0].= "_thu.jpg";
      
$ci->saveImage("../imagenes_db/".$img[0], 100);
      
header('Content-type: image/jpeg');      
      
$ci->showImage('jpg'', 90)
      exit;
   } ?>


See if that works for you.

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


Joined: 13 Jan 2005
Posts: 3
Location: Mexico

PostPosted: Tue Jul 05, 2005 6:20 pm    Post subject: Reply with quote

Hello there andy!

Yeah, after a couple of pages I found about that problem, yes its not your class but the fact that for security reasons, javascript won't close the window unless the current window was opened by script. So what I did is to remove the header, since I don't need to show the result of the class in that page, it is going to be shown in other page. But your explanation of the header was the key to answer my problem.

Many thanks Andy!!

best regards!
Back to top
View user's profile Send private message Send e-mail 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