Reputation: 49
PHP has all imagick libs, but in Laravel 5.4 it said class not found.
Code:
$img = new Imagick($full_name);
This if(extension_loaded('imagick')) returns true. So it's installed.
Any help why Laravel treat PHP class as it's own?
ERROR for $img = new \Imagick($full_name): FatalErrorException Class 'Imagick' not found
ERROR for $img = new Imagick($full_name) : FatalErrorException Class 'App\Http\Controllers\Imagick' not found
Upvotes: 2
Views: 3927
Reputation: 943
Your code tries to look at the default namespace for imagick, so you have to write it like this, and it will find imagick class in a proper way:
$img = new \Imagick($full_name);
Upvotes: 0