php.net |  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
43 + 25 = ?
Subscribe to this entry?

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

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

(test url: "http://www.osd.dk/test/test-ob.php")

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.

Regards,
Tais M. Hansen

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-15 06:49 UTC] sander@php.net
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] sniper@php.net
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.
--------

Closed.

 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Jan 25 08:03:35 2022 UTC