I am using Laravel 10 and my PHP Version => 8.2.12.
I am using Xampp for may project .I can not solve this error
if ($request->hasFile('product_images')) {
// $productImageModel = app(ProductsImage::class);
// $imagePaths = $productImageModel->typeImage($request, $product_id);
$manager = new ImageManager(new Driver());
$name_gen = hexdec(uniqid()) . '.' . $request->file('image')->getClientOriginalName();
$im = $manager->read($request->file('product_images'));
$im = $im->resize(370, 246);
$im->toJpeg(80)->save(base_path('public/front/images/products/large/' . $name_gen));
}
And the error:
InterventionImageExceptionsRuntimeException
PHP 8.2.12
10.40.0
ImageMagick extension not available with this PHP installation.
2
Answers
You need to install ImageMagick in your local system.
Refer to this: https://imagemagick.org/script/download.php
Other solution is to use composer with php/laravel.
The error you’re encountering, "InterventionImageExceptionsRuntimeException PHP 8.2.12 10.40.0 ImageMagick extension not available with this PHP installation," indicates that the ImageMagick extension is not installed or enabled in your PHP environment.
Here are the steps you can follow to resolve this issue:
Install ImageMagick: If ImageMagick is not installed on your system, download and install it from the official ImageMagick website.
Enable ImageMagick in PHP:
php.ini
file in the php folder of your XAMPP installation.;extension=imagick
. If found, uncomment it by removing the semicolon (;
). If not found, addextension=imagick
manually.Restart Your Server: After modifying php.ini, restart XAMPP to load the new settings.
Verify Installation: Create a PHP file with
phpinfo();
and check if ImageMagick information is displayed.If these steps don’t resolve the issue, check the compatibility of your PHP, Laravel, XAMPP, and Intervention Image library versions.