Fatal error: Uncaught Error: Class 'Imagick' not found in wordpress custom plugin

I am creating wordpress custom plugin and in that i will use 'imagick' class. Here are the sample code that is use in my custom plugin php file:

$imagick = new Imagick();
$imagick->readImage($b);
$imagick->writeImage('output.jpg');

but in that code i have an error like: Fatal error: Uncaught Error: Class 'Imagick' not found...


Solutions

Fatal error : Uncaught Error: Class 'Imagick' not found

It means that this class is not defined and therefore cannot be found.

Imagick is a native php extension.

You need to make sure that this extension exists on your server and configured. You might need your hosting provider assistance for this or in case you have a full access to the server install it by yourself.

Create a php file with the following code:

<?php
phpinfo();

Run it. It should show you all the existing and available extensions on your server. Check that value for Imagick.

Similar questions

Function in WordPress Plugin Not Looking in Path for Imagick
I have inherited a site with a custom plugin that is supposed to decrypt member information and a captured signature and put it into a PDF. The function uses (in this order) TCPDF to create the document; jSignature to convert the decrypted signature to Base30->Base64->Native->SVG; and Imagick to convert the signature to a JPG. Everything works up t...
WordPress issue ---- Fatal error: Uncaught Error: Call to undefined function convert_to_screen() /wp-admin/includes/class-wp-list-table.php:149
When I include class-wp-list-table.php then i can see an error . i am using composer auto load psr-4 , and also declare a namespeace Fatal error: Uncaught Error: Call to undefined function convert_to_screen() in /var/www/html/wordpress/building/wp-admin/includes/class-wp-list-table.php:149
Fatal error: Uncaught Error: Class 'WP_Block_Styles_Registry'
I am having some issues determining the solution to this problem below. The website was sent to our team to fix. Turned on error reporting in wp-config.php: define('WP_DEBUG', true); WordPress Theme: Grow Pro There has been a critical error on your website. Learn more about debugging in WordPress. For privacy reasons, I wouldn't be sharing the live...
Fatal error: Uncaught Error: Function name must be a string in php/class-style-generator.php
I've got the following errors on two sites: Fatal error: Uncaught Error: Function name must be a string in /home/lanesra2/public_html/wp-content/themes/Lanesra/framework/php/class-style-generator.php:123 Stack trace: #0 /home/lanesra2/public_html/wp-includes/class-wp-hook.php(286): I've not logged into the sites for ages, both are built on WordPres...
Fatal error: Uncaught Error: Class 'Automattic\WooCommerce\Client'
I am new to Woocomerce Rest API. I am trying to fetch all products from woocomerce in my new web application in php. But something went wrong from fetching that data. Here is my basic code :- But its showing me an error How to resolve this ?
Composer class not found fatal error - wordpress plugin development
I am trying to use composer to autoload my classes in a wordpress plugin. I wish for my models and controllers to reside within the GD namespace, however I would like to put my models and controllers into their own directories. I am facing the error message: Fatal error: Class 'GD\ShortcodeController' not found in /.. .../src/GD/App.php on line 10 ...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy .