I try to use first time Imagick to convert pdf files to images and it dont work for me.
When i try use Imagick with images files, its ok and working fine, problem is with PDF files.
My test php controller:
namespace AppHttpControllers;
use IlluminateHttpRequest;
use Imagick;
class NewspaperController extends Controller
{
/**
* @throws ImagickException
*/
public function show()
{
$imgExt = new Imagick();
$imgExt->readImage(public_path('storage/uploads/test.pdf'));
$imgExt->writeImages(public_path('storage/uploads/pdf_image_doc.jpg'), false);
return view('xxx');
}
}
When i open this in browser i get only "ImagickException" simple error.
I working on local, with:
- Laravel 8.54
- Windows 11
- XAMPP
- PHP Version 8.0.7
phpinfo():
- Compiler Visual C++ 2019
- Architecture x64
- imagick module version 3.5.1
- Imagick compiled with ImageMagick version ImageMagick 7.0.7-11 Q16 x64 2017-11-23
- Imagick using ImageMagick library version ImageMagick 7.0.7-25 Q16
x64 2018-03-04 - ImageMagick release date 2018-03-04
- ImageMagick number of supported formats: 240
Can anyone help?
2
Answers
Imagick has a release candidate that fixes this error. We were experiencing the same issue after upgrading to Laravel 8.
The new release candidate was posted on 11/10/2021 (6 days after this post).
https://windows.php.net/downloads/pecl/releases/imagick/3.6.0rc1/
Here is the line of code:
And,
and rename
gswin64.exe
togs.exe
And add Environment variables
I run in php 7.4, Ghost script 10.0 and Imagick ImageMagick-7.1.0-Q16 and laravel 7*
Thank you.