Re: imageJPEG problem.

From: Date: Tue, 25 Sep 2001 07:49:16 +0000
Subject: Re: imageJPEG problem.
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-68657@lists.php.net to get a copy of this message
Whooops, right. HTML after or before picture data doesn't make any sense :) I checked my a bit older function, which puts out image data correctly working. I'm sorry, but I didn't see a big difference to yours... But as I said before: I don't know what your doing at that lines where you wrote: $im = imagecreatefromjpeg("./test.jpg"); Imagejpeg($im,'',20); ImageDestroy($im); If I was you, I would try to open and read a valid jpeg file, just for testing, if the output works. If it works, I'd search the error in that lines written above. Here a snippet from my routine (and now I see: header really has to be image/jpeg, I must have been a little tired): require("../protected/php_db_access.inc"); mysql_select_db('mydb'); $picture_types=array("jpg" => "image/jpeg", "gif" => "image/gif", "png" => "image/png"); $result=mysql_query("SELECT type,picture FROM $table[pictures] WHERE id='$pic_id'"); $img_data=mysql_fetch_array($result); $mime=$picture_types[$img_data['type']]; $img_bin=$img_data['image']; header("Content-type: $mime"); echo $image; I know that the routine could be written better, but I think I wrote it in a hurry when I wrote it :) Perhaps you can do something with that routine (it works fine on a linux machine)... regards stefan rusterholz ----- Original Message ----- From: "Hugh Danaher" <hdanaher@earthlink.net> To: "Stefan Rusterholz" <scripts@interaktion.ch> Cc: "Php-General" <php-general@lists.php.net> Sent: Tuesday, September 25, 2001 9:33 AM Subject: Re: [PHP] imageJPEG problem. > Stephan, > Check that there are no html statements or blank lines above the <?php line. > I had a few blank lines in my first program, and it gave me the same error > message. > Hugh > > > ----- Original Message ----- > From: Stefan Rusterholz <scripts@interaktion.ch> > To: Johan Vikerskog (EMP) <Johan.Vikerskog@emp.ericsson.se>; > <php-general@lists.php.net> > Sent: Tuesday, September 25, 2001 12:13 AM > Subject: Re: [PHP] imageJPEG problem. > > > > > > ----- Original Message ----- > > From: "Johan Vikerskog (EMP)" <Johan.Vikerskog@emp.ericsson.se> > > To: "'Stefan Rusterholz'" <scripts@interaktion.ch>; "Johan > > Vikerskog > (EMP)" > > <Johan.Vikerskog@emp.ericsson.se>; <php-general@list.php.net> > > Sent: Tuesday, September 25, 2001 9:07 AM > > Subject: RE: [PHP] imageJPEG problem. > > > > > > > Thanks for your answer but the problem remains. > > > It says i allready have given the header information and everything > comes > > out in ascii. > > > > > > file://Johan > > > > > > -----Original Message----- > > > From: Stefan Rusterholz [mailto:scripts@interaktion.ch] > > > Sent: den 25 september 2001 08:55 > > > To: Johan Vikerskog (EMP); php-general@list.php.net > > > Subject: Re: [PHP] imageJPEG problem. > > > > > > > > > ----- Original Message ----- > > > From: "Johan Vikerskog (EMP)" <Johan.Vikerskog@emp.ericsson.se> > > > To: <php-general@lists.php.net> > > > Sent: Tuesday, September 25, 2001 8:47 AM > > > Subject: [PHP] imageJPEG problem. > > > > > > > > > > When trying to use a simple code like this below i receive an error > > which > > > says that it cant find the header. > > > > > > > > <? > > > > Header("Content-type: image/jpeg"); > > > > > > I don't know about the other stuff of your script, but when I wrote a > > > similar script, I took "content-type: image/jpg" and not 'jpeg'. > > > Probably that's the point... > > > > > > > $im = imagecreatefromjpeg("./test.jpg"); > > > > Imagejpeg($im,'',20); > > > > ImageDestroy($im); > > > > ?> > > > > > > > > It outputs the information in ascii and binary code. it doesn't show > the > > > picture > > > > > > > > Thanks for all the help you can give me. > > > > file://Johan > > > > > > > > -- > > > > PHP General Mailing List (http://www.php.net/) > > > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > > > For additional commands, e-mail: php-general-help@lists.php.net > > > > To contact the list administrators, e-mail: > php-list-admin@lists.php.net > > > > make sure you run the php-part at the very top of the file: > > <?php > > header(...); > > ?> > > <HTML> > > <HEAD> > > ...and so on > > > > > > if you have output before you execute the php part, your webserver will > > generate the header for you and then it is impossible to send another > header > > (exactly because of what the warning tells you: the headers are already > > sent - but by the server and not by you and the server normally assumes > > text/html or text/plain). > > > > I hope, it helps > > regards > > > > Stefan Rusterholz > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > >

« previous php.general (#68657) next »