PHP/Imagick: Image only written if echo'd
Posted: 2011-03-16T23:18:41-07:00
The following PHP, when passed this image, writes 0 bytes to $cache (but works fine with all other known images). If the echo just before the call to writeImage is uncommented, it works fine. (The PHP is being run via <?php exec('php -f thumb.php -- img=zc9vfo.png >output'); ?> for unrelated reasons.) If anyone can give me a hint for what to look into, that would be fantastic.
EDIT: The script is actually segfaulting whether the image data is written (because of getImageBlob) or not. Here's a minimal test case, to be run via php -f thumb.php with the image in question saved in the same directory as original.png:
EDIT: The script is actually segfaulting whether the image data is written (because of getImageBlob) or not. Here's a minimal test case, to be run via php -f thumb.php with the image in question saved in the same directory as original.png:
Code: Select all
<?php
$thumb = new Imagick('original.png');
$thumb->setImageFormat('png');
//echo $thumb->getImageBlob();
$thumb->writeImage('duplicate.png');
?>