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.


image output as jibberish

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


Joined: 05 Mar 2004
Posts: 2

PostPosted: Fri Mar 05, 2004 5:53 pm    Post subject: image output as jibberish Reply with quote

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(5050ccCENTRE);
    
$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??-Confused#??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(5050ccCENTRE);
    
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
View user's profile Send private message
Scott
Newbie


Joined: 05 Mar 2004
Posts: 2

PostPosted: Fri Mar 05, 2004 11:59 pm    Post subject: Reply with quote

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
View user's profile Send private message
amnuts
Site Admin


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

PostPosted: Sat Mar 06, 2004 3:14 am    Post subject: Reply with quote

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