I have to run a function that has an option to use GD or ImageMagick - what is the best way (php) to test if ImageMagick is installed, and return a true or false?
To enable Imagick for your website, go to your Site Tools -> Dev -> PHP Manager. Click the PHP Extensions tab and find the entry for the “imagick” extension in the list that appears. Then click the Change value button (pencil icon), select the On radio button for Status and save the changes.
By default, ImageMagick is installs binaries in /../usr/local/bin , libraries in /../usr/local/lib , header files in /../usr/local/include and documentation in /../usr/local/share . You can specify an alternative installation prefix other than /../usr/local by giving configure the option --prefix=PATH .
The Imagick::getVersion() function is an inbuilt function in PHP which is used to get the ImageMagick API version. Parameters: This function does not accept any parameter. Return Value: This function returns the ImageMagick API version.
Use an if
condition with extension_loaded()
function to check whether you have the extension is loaded
if(extension_loaded('imagick')) {
echo 'Imagick Loaded';
}
Documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With