Level 104
Make sure you have the Imagick module installed for you web server's PHP version (it is one of the requirements for the package to work)
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi all, I'm not able to use spatie converter in my server:
<?php
namespace App\Http\Controllers\Documents;
use Spatie\PdfToImage\Pdf as JPG;
class converter
{
static function PdfToJpg($pdf_path){
//conversione del pdf in jpg
self::mylog("Funzione PdfToJpg ... converto il file ".public_path($pdf_path));
$jpgs=[];
$img = new JPG(public_path($pdf_path));
self::mylog("Ho istanziato il convertitore spatie");
$pages=$img->getNumberOfPages();
$jpgs=[];
for($i=1;$i <= $pages;$i++){
$img->setPage($i)->saveImage(public_path($pdf_path.$i.'.jpg'));
self::mylog("Ho salvato il jpeg");
$jpgs[]=$pdf_path.$i.'.jpg';
}
return $jpgs;
}
}
thi is my class that crashes when it does: $img = new JPG(public_path($pdf_path));
In /var/log/apache2/error.log I can rread this error:
PHP Fatal error: Class 'Imagick' not found in /home/ottaviane/Sviluppo/WebDocuments/app/Http/Controllers/Documents/converter.php on line 16, referer: https://webdocuments.mydomain.it
I installed spatie with: composer require spatie/pdf-to-image
What appen? Can you help me please? Bye bye.
Please or to participate in this conversation.