5

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?

Orangeman555
  • 1,179
  • 2
  • 21
  • 45

2 Answers2

17

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

Mr. Alien
  • 153,751
  • 34
  • 298
  • 278
0

Just create an if condition checking for installed extension

if (!extension_loaded('imagick')) 
{
    echo 'imagick not installed';
}
else 
{
    echo 'imagick installed'; 
}
Fabio
  • 23,183
  • 12
  • 55
  • 64