I am trying to convert my pdf file first page to thumbnail and I already installed ImageMagick and GhostScript for this purpose. Imagick extension successfully installed and showed up in phpinfo(). But I am getting the below error:
Below is my code:
$image = new Imagick($_SERVER['DOCUMENT_ROOT'] . '/convert-pdf/file.pdf[0]');
$im->setImageFormat('jpg');
header('Content-Type: image/jpeg');
echo $im;
You have $image
and are using $im
; try changing $image
to $im
.