RE: [PHP] IMAGE CREATE() header problem
Create a separate PHP file that creates your image, and put it in the HTML like this: All file.php should do is output image headers and the binary image data. ---John Holmes... > -Original Message- > From: Dani [mailto:[EMAIL PROTECTED]] > Sent: Saturday, May 25, 2002 12:33 AM > To: Gerard Samuel > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] IMAGE CREATE() header problem > Importance: High > > Thanks for the advice. > I found out there I shouldn't put the script in between any html tags at > all. > > Now my question is: > > What if we want to insert image which is generated by the php in the > table? > > thanks > > Gerard Samuel wrote: > > > Double check your file for the whitspace like the others have stated. > > I tried your example and had no problems with it... > > > > Dani wrote: > > > > >Hi again, > > > > > >I have got this script : > > > > >//setup image > > >$height = 200; > > >$width = 200; > > > > > >$im = ImageCreate($width,$height); > > >$white = ImageColorAllocate($im, 255, 255, 255); > > >$black = ImageColorAllocate($im, 0, 0, 0); > > > > > >//Draw on image > > >ImageFill($im, 0, 0, $black); > > >ImageLine($im, 0, 0, $width, $height, $white); > > >ImageString($im, 4, 50, 150, "Sales", $white); > > > > > >//output image > > >Header ("Content-type: image/png"); > > >ImagePng ($im); > > > > > >//Clean up > > >ImageDestroy($im); > > > > > >?> > > > > > >but when I execute the script I got this ERROR MESSAGE: > > > Cannot add header information - headers already sent by (output > started > > >at D:\graphic_practise\index.php:10) in D:\graphic_practise\index.php > on > > >line 25 > > > > > >Any advise? > > > > > >thanks! > > > > > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IMAGE CREATE() header problem
Thanks for the advice. I found out there I shouldn't put the script in between any html tags at all. Now my question is: What if we want to insert image which is generated by the php in the table? thanks Gerard Samuel wrote: > Double check your file for the whitspace like the others have stated. > I tried your example and had no problems with it... > > Dani wrote: > > >Hi again, > > > >I have got this script : > > >//setup image > >$height = 200; > >$width = 200; > > > >$im = ImageCreate($width,$height); > >$white = ImageColorAllocate($im, 255, 255, 255); > >$black = ImageColorAllocate($im, 0, 0, 0); > > > >//Draw on image > >ImageFill($im, 0, 0, $black); > >ImageLine($im, 0, 0, $width, $height, $white); > >ImageString($im, 4, 50, 150, "Sales", $white); > > > >//output image > >Header ("Content-type: image/png"); > >ImagePng ($im); > > > >//Clean up > >ImageDestroy($im); > > > >?> > > > >but when I execute the script I got this ERROR MESSAGE: > > Cannot add header information - headers already sent by (output started > >at D:\graphic_practise\index.php:10) in D:\graphic_practise\index.php on > >line 25 > > > >Any advise? > > > >thanks! > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IMAGE CREATE() header problem
Double check your file for the whitspace like the others have stated. I tried your example and had no problems with it... Dani wrote: >Hi again, > >I have got this script : >//setup image >$height = 200; >$width = 200; > >$im = ImageCreate($width,$height); >$white = ImageColorAllocate($im, 255, 255, 255); >$black = ImageColorAllocate($im, 0, 0, 0); > >//Draw on image >ImageFill($im, 0, 0, $black); >ImageLine($im, 0, 0, $width, $height, $white); >ImageString($im, 4, 50, 150, "Sales", $white); > >//output image >Header ("Content-type: image/png"); >ImagePng ($im); > >//Clean up >ImageDestroy($im); > >?> > >but when I execute the script I got this ERROR MESSAGE: > Cannot add header information - headers already sent by (output started >at D:\graphic_practise\index.php:10) in D:\graphic_practise\index.php on >line 25 > >Any advise? > >thanks! > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IMAGE CREATE() header problem STILL
Thanks Miguel! I have checked everything but it seems there aren't any blank space but I still get the error message. Miguel Cruz wrote: > On Sat, 25 May 2002, Dani wrote: > > I have got this script : > > > //setup image > > $height = 200; > > $width = 200; > > > > $im = ImageCreate($width,$height); > > $white = ImageColorAllocate($im, 255, 255, 255); > > $black = ImageColorAllocate($im, 0, 0, 0); > > > > //Draw on image > > ImageFill($im, 0, 0, $black); > > ImageLine($im, 0, 0, $width, $height, $white); > > ImageString($im, 4, 50, 150, "Sales", $white); > > > > //output image > > Header ("Content-type: image/png"); > > ImagePng ($im); > > > > //Clean up > > ImageDestroy($im); > > > > ?> > > > > but when I execute the script I got this ERROR MESSAGE: > > Cannot add header information - headers already sent by (output started > > at D:\graphic_practise\index.php:10) in D:\graphic_practise\index.php on > > line 25 > > Check to make sure you don't have any blank lines before the first > miguel > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] IMAGE CREATE() header problem
Something is being output in index.php on Line 10. That's causing the headers to fail. Check for whitespace. ---John Holmes... > -Original Message- > From: Dani [mailto:[EMAIL PROTECTED]] > Sent: Friday, May 24, 2002 11:27 PM > To: [EMAIL PROTECTED] > Subject: [PHP] IMAGE CREATE() header problem > Importance: High > > Hi again, > > I have got this script : > //setup image > $height = 200; > $width = 200; > > $im = ImageCreate($width,$height); > $white = ImageColorAllocate($im, 255, 255, 255); > $black = ImageColorAllocate($im, 0, 0, 0); > > //Draw on image > ImageFill($im, 0, 0, $black); > ImageLine($im, 0, 0, $width, $height, $white); > ImageString($im, 4, 50, 150, "Sales", $white); > > //output image > Header ("Content-type: image/png"); > ImagePng ($im); > > //Clean up > ImageDestroy($im); > > ?> > > but when I execute the script I got this ERROR MESSAGE: > Cannot add header information - headers already sent by (output started > at D:\graphic_practise\index.php:10) in D:\graphic_practise\index.php on > line 25 > > Any advise? > > thanks! > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IMAGE CREATE() header problem
On Sat, 25 May 2002, Dani wrote: > I have got this script : > //setup image > $height = 200; > $width = 200; > > $im = ImageCreate($width,$height); > $white = ImageColorAllocate($im, 255, 255, 255); > $black = ImageColorAllocate($im, 0, 0, 0); > > //Draw on image > ImageFill($im, 0, 0, $black); > ImageLine($im, 0, 0, $width, $height, $white); > ImageString($im, 4, 50, 150, "Sales", $white); > > //output image > Header ("Content-type: image/png"); > ImagePng ($im); > > //Clean up > ImageDestroy($im); > > ?> > > but when I execute the script I got this ERROR MESSAGE: > Cannot add header information - headers already sent by (output started > at D:\graphic_practise\index.php:10) in D:\graphic_practise\index.php on > line 25 Check to make sure you don't have any blank lines before the first http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php