图像包含想象力的错误

时间:2012-07-28 15:37:17

标签: php imagick

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

2 个答案:

答案 0 :(得分:0)

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

$image->thumbnailImage(100, 100);

答案 1 :(得分: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;