|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-08-20 14:50 UTC] karateka2000 at gmail dot com
Description:
------------
"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:
---------------
<?php
$im = new Imagick();
$im->readImage('test.jpg');
$fp = fopen("php://memory", 'r+');
$im->writeImageFile($fp);
rewind($fp);
$out = stream_get_contents($fp);
fclose($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".
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 10:00:02 2025 UTC |
Confirmed. This bellow code should produce base64encoded thumb data. but it produces an empty string $image = new Imagick($destPath); $image->thumbnailimage(0, 250); $image->setImageCompression(Imagick::COMPRESSION_JPEG); $image->setImageCompressionQuality(70); $image->stripImage(); $handle = fopen("php://memory", "rw+"); $image->writeImageFile($handle); fseek($handle, 0); $base64Thumb = base64_encode(stream_get_contents($handle)); fclose($handle); var_dump($base64Thumb);