Jump to content

Cannot Modify Header Information


technode

Recommended Posts

Ok, so I have tried everything I can think of and wandered the web too.. nothing seems to work.

I am trying to create an image with PHP. Which should work, but doesn't.

[code]
<html>
<head></head>
<body><?php

header("Content-type: image/png");
$string = "image";
$im    = imagecreatefrompng("button1.png");
$orange = imagecolorallocate($im, 220, 210, 60);
$px    = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagestring($im, 3, $px, 9, $string, $orange);
imagepng($im);
imagedestroy($im);

?></body></html>[/code]

the error is:
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\createImg\createImg.php:3) in C:\Program Files\Apache Group\Apache2\htdocs\createImg\createImg.php on line 5
[/quote]

I have tried removing extra returns and white space in the code, in the ini files.... It's an Apapche 2 server with php 5.1.4

Please help me!!!!

Thanks in advance
Link to comment
https://forums.phpfreaks.com/topic/13240-cannot-modify-header-information/
Share on other sites

[!--quoteo(post=389408:date=Jun 29 2006, 02:38 PM:name=technode)--][div class=\'quotetop\']QUOTE(technode @ Jun 29 2006, 02:38 PM) [snapback]389408[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Ok, so I have tried everything I can think of...[/quote]

...except reading the manual:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP.
[/quote]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.