Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

Intervention Image facade or class not found after upgrading

ErrorThe Image facade stops working after a composer update

Short answer

Intervention Image 3 removed the Laravel service provider and the old facade from the core package. Install intervention/image-laravel, import Intervention\Image\Laravel\Facades\Image, publish config/image.php, and call read() instead of make(). Without the extra package, the old class name does not exist.

  • Applies to Intervention Image 3, Laravel 12, PHP 8.3
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    See which major version is installed and whether the Laravel integration package is there.

    composer show intervention/image
    composer show intervention/image-laravel
  2. 2Match what you see, then jump to its fix

    1. 1composer show intervention/image-laravel says the package is not found.The Laravel integration package is not installedFix
    2. 2The error names Intervention\Image\Facades\Image, or you copied an old tutorial.The code still imports the version 2 facade namespaceFix
    3. 3The config file still holds a plain string such as 'gd' or 'imagick' for the driver.A string driver name is left in the configurationFix

What does the error look like?

  • The Image facade stops working after a composer update
  • Class "Intervention\Image\Facades\Image" not found

Cause 1 of 3

The Laravel integration package is not installed

1Check

Since version 3 the Laravel code is a separate package. The core package alone has no Laravel facade.

composer show intervention/image-laravel

2Fix

Install the package, then publish its config file.

composer require intervention/image-laravel
php artisan vendor:publish --provider="Intervention\Image\Laravel\ServiceProvider"

3Verify

The file config/image.php exists.

ls config/image.php

Confirmed by image.intervention.io

Did this fix it?

Cause 2 of 3

The code still imports the version 2 facade namespace

1Check

The v2 facade lived in Intervention\Image\Facades. In v3 the Laravel facade is in Intervention\Image\Laravel\Facades, and the upgrade guide says the old Laravel service providers were removed.

grep -rn "Intervention\\\\Image" app config routes | head

2Fix

Change the import, and use read() where the old code used make().

use Intervention\Image\Laravel\Facades\Image;

$image = Image::read($request->file('image'))->resize(300, 200);

3Verify

Run the route that processes an image.

php artisan route:list

Confirmed by image.intervention.io

Did this fix it?

Cause 3 of 3

A string driver name is left in the configuration

1Check

Version 2 chose the driver with a string. Version 3 expects the driver class name.

grep -rn "driver" config/image.php

2Fix

Use the driver class, or create the manager yourself without the facade.

use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Gd\Driver;

$manager = new ImageManager(new Driver());
$image = $manager->read('images/example.jpg');

3Verify

Read one real file with the manager and resize it; no exception means the driver loads.

php -m | grep -i -E "gd|imagick"

Confirmed by image.intervention.io

Did this fix it?

How do I stop it coming back?

  • Pin the major version in composer.json (intervention/image:^3) so an update cannot change the API.
  • Read the upgrade guide before moving a major version of an image library.
  • Check that GD or Imagick is enabled with php -m, because the library needs one of them.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

composer require maatwebsite/excel fails to install

Composer says the package needs an older PHP than the one installed

Composer refuses maatwebsite/excel when the PHP version or a PHP extension does not match what the package and PhpSpreadsheet need.

3 causes, each with a fix

Back end

composer require laravel/horizon fails: ext-pcntl is missing

laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system

Horizon needs the pcntl extension, and Composer refuses to install it where PHP lacks that extension.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.