ZF2-158: Impossible to show image generated by imagepng / imagejpeg functions

Issue Type: Bug Created: 2012-02-10T12:34:43.000+0000 Last Updated: 2012-08-18T09:07:51.000+0000 Status: Resolved Fix version(s): Reporter: david quintard (booradleys) Assignee: Ralph Schindler (ralph) Tags: Related issues: Attachments:


Hi there, The following code works fine with zf1.11 but not in zf2:

<pre class="highlight">
public function indexAction()   
        $png = imagecreatetruecolor(800, 600);
        imagesavealpha($png, true);
        $trans_colour = imagecolorallocatealpha($png, 0, 0, 0, 127);
        imagefill($png, 0, 0, $trans_colour);
        $Yellow = imagecolorallocate($png, 255, 255, 0);
        imagefilledellipse($png, 650, 150, 200, 200, $Yellow );
        header("Content-type: image/png");

zf1.11 => display yellow circle zf2 => display "L'image ne peut être affichée car elle contient des erreurs"

Errors remains by adding:

<pre class="highlight">

and replacing :

<pre class="highlight">
header("Content-type: image/png");


<pre class="highlight">
$headers = $this->response->headers();
$headers->addHeaderLine('Content-Type', 'image/jpeg');


Posted by Frank Brückner (frosch) on 2012-02-10T16:40:59.000+0000

Code tags added.

Posted by Koen Pieters (koen) on 2012-08-02T12:10:58.000+0000

Hi David,

Can you still reproduce this with the latest code?

I've tried your code snippet in Rob Allen's tutorial and it worked fine for me.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.