Skip to content
Advertisement

Why class Imagick not found in laravel 7.0?

I had install Imagick:

download:
https://windows.php.net/downloads/pecl/snaps/imagick/3.4.3/php_imagick-3.4.3-7.2-ts-vc15-x64.zip
https://windows.php.net/downloads/pecl/deps/ImageMagick-7.0.7-11-vc15-x64.zip
extract php_imagick.dll to ext/
extract ImageMagick-7.0.7 to one path
ADD ImageMagick-7.0.7/bin to SYSTEM PATH
ADD "extension=imagick" in php.ini
ADD LoadFile "/yourImageMagickPath/bin/CORE_RL_Magick++_.dll" in httpd.conf

Result of phpinfo: enter image description here

I try test in controller:

 public function index()
    {
        $im = new Imagick();
        $im->newPseudoImage(100, 100, "magick:rose");
        $im->setImageFormat("png");
        $im->roundCorners(5,3);
        $type=$im->getFormat();
        header("Content-type: $type");
        echo $im->getimageblob();
        return view('home');
    }

It occur error:

Class 'AppHttpControllersImagick' not found

Why class Imagick not found in laravel 7.0?

Advertisement

Answer

Class 'AppHttpControllersImagick' not found means that Imagick is not in the namespace AppHttpControllers. If you want to use Imagick you need to prepend it with the “root” namespace . Change

$im = new Imagick();

to

$im = new Imagick();
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement