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
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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.