【问题标题】:The image contain error with imagick图像包含 imagick 错误
【发布时间】:2012-07-28 15:37:17
【问题描述】:
<?php

header('Content-type: image/jpeg');

$image = new Imagick('image.jpg');

// If 0 is provided as a width or height parameter,
// aspect ratio is maintained
$image->thumbnailImage(100, 0);

echo $image;

?>

出现错误图像“http://localhost/test/into.php”无法显示,因为它包含错误。请解决这个问题?

【问题讨论】:

标签: php imagick


【解决方案1】:

请阅读注释行中的详细信息

<?php

//drawing stuff that creates $image

ob_get_clean(); //this statement is what mine was lacking before I could get it to work properly
header("Content-type: image/png");
echo $image;

【讨论】:

    【解决方案2】:

    您的图像是在 0 像素高度创建的,并且格式可能无效。试试看docs

    $image->thumbnailImage(100, 100);
    

    【讨论】:

      猜你喜欢
      • 2011-03-09
      • 1970-01-01
      • 1970-01-01
      • 2015-03-29
      • 2015-03-13
      • 1970-01-01
      • 2014-04-28
      • 1970-01-01
      • 2022-06-14
      相关资源
      最近更新 更多