Search code examples
phpimageimagick

How to fix Fatal error: Uncaught Error: Class 'Imagick' not found in [Directory] lib/htm.php on line 558


I have a project to make a Miiverse clone in 24 hours and i have a problem when i want to sign in the problem is related to images (i think) here is the code i use :

$imagick = new \Imagick(realpath($filename));

    $format = $imagick->getImageFormat();
    if ($format == 'GIF') {
        $imagick = $imagick->coalesceImages();
        do {
            $imagick->scaleImage($width, $height);
        } while ($imagick->nextImage());
        $imagick = $imagick->deconstructImages();
    } else {
        $imagick->scaleImage($width, $height);
    }

    $resized = $imagick->getImagesBlob();
}

$get_keys = $dbc->prepare('SELECT * FROM cloudinary_keys ORDER BY RAND() LIMIT 1');
$get_keys->execute();
$key_result = $get_keys->get_result();
$keys = $key_result->fetch_assoc();

Please help me i started PHP a few months ago Thanks for responding ! Aymo

I tried to remove the problem line but i caused more errors and i expected to repair the problem


Solution

  • I am just reiterating what user3783243 says above. If you install the module that error will go away.

    see https://www.php.net/manual/en/book.imagick.php