开发者

Why doesn't imagick work?

<?php
$im = new imagick('vui.pdf[0]');
$im->set开发者_如何转开发ImageFormat( "png" );
header( "Content-Type: image/jpeg" );
echo $im;
?>

I am using heliohost, but when i run this script, it show me a 500 Internal Server Error (http://iamsnoob.co.cc/open.php ), why?


This is a wild guess, but ImageMagick requires Ghostscript to be able to open PDF files. It could be that Ghostscript is not present.

I would try with a JPEG image first. If that works with the same syntax, it's likely to be that.

The very best thing would be to look into the error logs and see what the 500 error is about exactly. Some providers offer access to the error log through their control panels or FTP logins.

Edit: A user has this to say in the PHP manual on Imagick:

To load image (usually vector image, like PDF) with larger resolution than image's default is, you have to set resolution before reading the file, like this:

<?php $im = new Imagick(); 
$im->setResolution( 300, 300 ); 
$im->readImage( "test.pdf" ); ?>

this may well be the issue - try setting a lower resolution.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜