View previous topic :: View next topic |
Author |
Message |
Scott Newbie
Joined: 05 Mar 2004 Posts: 2
|
Posted: Fri Mar 05, 2004 5:53 pm Post subject: image output as jibberish |
|
|
well i've given up trying to solve this myself so hopefully you can help me figure out wth is going on.
I first tried using this in my page:
PHP: | <?php $cc = new canvasCrop(true);
$image_path = "files/".$row["file_path"];
$cc->loadImage($image_path);
$cc->cropByPercent(50, 50, ccCENTRE);
$cc->showImage('jpg'); ?> |
after a PHP: | <?php require "crop/class.cropcanvas.php"; ?> | of course.
This just outputs a very large stream of nonsense chars where the image should be.
so i tried out the interface thing and loaded up the test page and got this when i clicked the crop image: Quote: | Warning: Cannot modify header information - headers already sent by (output started at /www/crop/class.cropcanvas.php:538) in /www/crop/test.cropinterface.php on line 10
????JFIF??????K?r????J??? >$?K??????'???!?J?[?b???:g? ?q?!??{?8???????>?Q??? ??%?s?[Þ ???????~xU??o???I?ts?????M?q????U>?qCð?_???Z?SW$???*?????I?>???$??Ç?,T?????????????W??>F?K???O?????????????1??E??<>iR???|G?o??u?\???o??????'R?V??mú???h?6?~'?X???&???}4|J?w??????????(@?,uk?&???_????o???J???\????C???o????~!x?ž ????????#??_f\ ??<????q7?qVa??a???-z??~(???????f?j??L??8C??~?_0??8??TVI??- #??1 |
which is what i had gotten when i tried:
PHP: | <?php $cc = new canvasCrop(true);
$image_path = "files/".$row["file_path"];
$cc->loadImage($image_path);
$cc->cropByPercent(50, 50, ccCENTRE);
header('Content-type: image/jpeg');
$cc->showImage('jpg'); ?> |
PHP ver: 4.3.3
GD ver: 2.0.15 compatible
server info: Linux breeze.phpwebhosting.com 2.4.20-29.7.progeny.3 #1 Tue Feb 17 18:38:24 EST 2004 i686
any ideas!?? |
|
Back to top |
|
 |
Scott Newbie
Joined: 05 Mar 2004 Posts: 2
|
Posted: Fri Mar 05, 2004 11:59 pm Post subject: |
|
|
bleh.. i gave up this and ended up writing a very basic inflexible standard crop and resize script.
i finally got this to work by using
<img src=myscript.php?img=image_to_resize.jpg> in my main code..
I did learn how to write the script from taking bits and pieces from yours though, so thx! |
|
Back to top |
|
 |
amnuts Site Admin

Joined: 01 Sep 2002 Posts: 662 Location: East Sussex, England
|
Posted: Sat Mar 06, 2004 3:14 am Post subject: |
|
|
Hi Scott, welcome to the board!
Even though you gave up on the script, the solution I think you'll find is very easy. You have white space in the class or your script, outside of the php tags. Remove them and you're golden.
The showImage function will output an HTTP header, and that requires NOTHING to have been sent to the browser before hand, otherwise headers will already been sent and cannot be altered.
Try it out and let me know the results. If you cannot sort it out, send me your script and I'll try it for you.
Regards,
Andy |
|
Back to top |
|
 |
|
|
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
|