|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13103 Image output functions doesn't work properly with output buffering.
Submitted: 2001-09-03 04:38 UTC Modified: 2001-11-15 19:23 UTC
From: tais dot hansen at osd dot dk Assigned:
Status: Closed Package: Output Control
PHP Version: 4.0.4pl1 OS: FreeBSD 4.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: tais dot hansen at osd dot dk
New email:
PHP Version: OS:


 [2001-09-03 04:38 UTC] tais dot hansen at osd dot dk

$im = imageCreateFromPNG( "test-ob.png" );
imagePNG( $im );
$outbuffer = ob_get_contents();
header( "Content-Type: image/gif" );
print $outbuffer;

(test url: "")

The script above will fail on the "header( ..." line stating that output has already been sent and thus no more headers can be added.

For some reason the imagePNG() function (and other image output functions) seems to end the header section of the output even though output buffering is active.

I'm currently unable to test this on a newer version of php.

Tais M. Hansen


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-15 06:49 UTC]
Are you sure there is no whitespace before the <?php-tag???

And if that's not the case, can you try the latest snapshot or at least 4.0.6?
 [2001-11-15 19:23 UTC]
User feedback:

I haven't been able to check it in version 4.0.6 until last week. But it
seems like it works in 4.0.6. So I guess case is closed then. Great.


PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Dec 02 10:01:26 2023 UTC