0
<?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”无法显示,因为它包含错误。请解决这个问题?

4

2 回答 2

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;
于 2020-05-29T09:26:52.513 回答
0

您的图像是在 0 px 高度创建的,并且格式可能无效。尝试并查看文档

$image->thumbnailImage(100, 100);
于 2012-07-28T15:49:40.697 回答