I'm having problems with reading a file with Imagick. I've installed the imagick and ghostscript extension successfully.
This is what I'm doing:
<?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;
?>
I'm getting the error:
Fatal error: Uncaught exception 'ImagickException' with message 'Failed to read the file' in /Applications/MAMP/htdocs/imagick.php on line 10
When I try to execute the following command in my terminal:
convert magazine_cover.pdf magazine_cover.jpeg
I'm getting a warning:
**** 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.
But he created the jpeg ... . Why doesn't this work in the browser?