JBZoo\Utils\Image::checkGD PHP Method

checkGD() public static method

Require GD library
public static checkGD ( boolean $thowException = true ) : boolean
$thowException boolean
return boolean
    public static function checkGD($thowException = true)
    {
        $isGd = extension_loaded('gd');
        // Require GD library
        if ($thowException && !$isGd) {
            throw new Exception('Required extension GD is not loaded.');
            // @codeCoverageIgnore
        }
        return $isGd;
    }

Usage Example

Beispiel #1
0
 /**
  * Constructor
  *
  * @param string|null $filename
  * @param bool|null $strict
  *
  * @throws Exception
  * @throws \JBZoo\Utils\Exception
  */
 public function __construct($filename = null, $strict = false)
 {
     Helper::checkGD();
     if (ctype_print($filename) && FS::isFile($filename)) {
         $this->loadFile($filename);
     } elseif (Helper::isGdRes($filename)) {
         $this->loadResource($filename);
     } elseif (is_string($filename) && $filename) {
         $this->loadString($filename, $strict);
     }
 }