我是您的助手,下面为您翻译内容:
我在使用Imagick读取文件时遇到了问题。我已经成功安装了Imagick和Ghostscript扩展。
这是我的操作步骤:
<?php
$im = new Imagick();
$im->setResolution(300, 300);
$im->readImage('/Applications/MAMP/htdocs/mywebsite/wp-content/plugins/myplugin/uploads/magazine_cover.pdf[0]');
$im->setImageFormat('jpg');
header('Content-Type: image/jpeg');
echo $im;
?>
我遇到了以下错误:
Fatal error: Uncaught exception 'ImagickException' with message 'Failed to read the file' in /Applications/MAMP/htdocs/imagick.php on line 10
当我尝试在终端中执行以下命令时:
convert magazine_cover.pdf magazine_cover.jpeg
我收到了一个警告:
**** Warning: considering '0000000000 XXXXX n' as a free entry.
**** This file had errors that were repaired or ignored.
**** The file was produced by:
**** >>>> Mac OS X 10.11.3 Quartz PDFContext <<<<
**** Please notify the author of the software that produced this
**** file that it does not conform to Adobe's published PDF
**** specification.
但是他创建了jpeg格式的图片...为什么在浏览器中无法使用?