skip to Main Content

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


  1. 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.

    Login or Signup to reply.
  2. 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:

    1. Install ImageMagick: If ImageMagick is not installed on your system, download and install it from the official ImageMagick website.

    2. Enable ImageMagick in PHP:

    • Locate the php.ini file in the php folder of your XAMPP installation.
    • Search for ;extension=imagick. If found, uncomment it by removing the semicolon (;). If not found, add extension=imagick manually.
    1. Restart Your Server: After modifying php.ini, restart XAMPP to load the new settings.

    2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search