|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59378 Imagick::writeImageFile can't write whole data using php://memory output stream
Submitted: 2010-08-20 14:50 UTC Modified: 2015-01-25 04:22 UTC
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: karateka2000 at gmail dot com Assigned: mkoppanen (profile)
Status: No Feedback Package: imagick (PECL)
PHP Version: 5.2.11 OS: CentOS 5.5 x86_64
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: karateka2000 at gmail dot com
New email:
PHP Version: OS:


 [2010-08-20 14:50 UTC] karateka2000 at gmail dot com
"Imagick::writeImageFile" works properly if the file handler is created from usual filesystems.
And, using file handler from other stream wrappers (i.e. php://memory , php://temp), it works, but not complete.

I tried some type of images (gif, jpeg, and png), the image cut off the bottom in all cases.

Reproduce code:
$im = new Imagick();
$fp = fopen("php://memory", 'r+');
$out = stream_get_contents($fp);
header("Content-type: image/jpeg");
echo $out;

Expected result:
the browser shows the image same as "test.jpg". 

Actual result:
the browser shows half or more topside part of "test.jpg".


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-18 04:09 UTC]
I can reproduce this and will look into it.
 [2011-12-15 18:41 UTC] neel dot basu dot z at gmail dot com
Confirmed. This bellow code should produce base64encoded thumb data. but it 
produces an empty string

$image = new Imagick($destPath);
$image->thumbnailimage(0, 250);
$handle = fopen("php://memory", "rw+");
fseek($handle, 0);
$base64Thumb = base64_encode(stream_get_contents($handle));
 [2013-12-03 11:35 UTC]
-Assigned To: +Assigned To: mkoppanen
 [2015-01-15 19:50 UTC]
-Status: Verified +Status: Feedback
 [2015-01-15 19:50 UTC]

I can't reproduce this on a supported version of PHP. Please can you test again with a supported version.

I've also added a test to hopefully spot if it should occur again:
 [2015-01-25 04:22 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Sep 20 11:03:37 2021 UTC