I am getting an error code when using this code to convert my pdf to jpg. I haven't use imagemagick
before, so I'm not sure what I'm doing wrong.
The code i am using:
$im = new Imagick();
$im->setResolution(300,300);
$im->readimage('artwork/$file_name');
$im->setImageFormat('jpeg');
$im->writeImage('artwork/jpeg/$file_name');
$im->clear();
$im->destroy();
The error i am getting:
Fatal error: Uncaught exception 'ImagickException' with message 'unable to open image `@artwork/$file_name': No such file or directory @ blob.c/OpenBlob/2480' in /www/xx/xxxxx/xxxx/xxxx/xx/upload_artwork2.php:58 Stack trace: #0 /www/xx/xxxxx/xxxx/xxxx/xx/upload_artwork2.php(58): Imagick->readimage('@artwork/$file_...') #1 {main} thrown in /www/xx/xxxxx/xxxx/xxxx/xx/upload_artwork2.php on line 58
Is this the best way to do it, is there another way?
I changed the code i was using to this and it worked fine. Only problem is that you need to add the .jpg or .pdf when uploading to the database, but works fine otherwise.