图像包含imagick错误

问题描述 投票:0回答:2
<?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
2个回答
0
投票

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

$image->thumbnailImage(100, 100);

0
投票

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

<?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;
© www.soinside.com 2019 - 2024. All rights reserved.