/**
  * Return a scaled, cached version of the source image for front-end use
  *
  * @param string $json
  * @param array $opts
  * @param modTemplateVar $tv
  * @internal param array $params
  * @return string
  */
 public function getImageURL($json, $opts = array(), modTemplateVar $tv)
 {
     // Check system settings for crop engine override
     $engineClass = $this->modx->getOption('imageplus.crop_engine_class', null, false);
     // Do some basic intelligent sniffing
     if (!$engineClass) {
         if (CropEngines\PhpThumbsUp::engineRequirementsMet($this->modx)) {
             $engineClass = '\\ImagePlus\\CropEngines\\PhpThumbsUp';
         } else {
             if (CropEngines\PhpThumbOf::engineRequirementsMet($this->modx)) {
                 $engineClass = '\\ImagePlus\\CropEngines\\PhpThumbOf';
             }
         }
     }
     /**
      * @var ImagePlus\CropEngines\AbstractCropEngine $cropEngine
      */
     $cropEngine = new $engineClass($this->modx);
     // Check crop engine is usable
     if (!$cropEngine->engineRequirementsMet($this->modx)) {
         $this->modx->log(xPDO::LOG_LEVEL_ERROR, "Requirements not met for crop engine [{$engineClass}]", '', 'Image+');
         return 'Image+ error - requirements not met for crop engine';
     }
     return $cropEngine->getImageUrl($json, $opts, $tv);
 }
 /**
  * Check dependencies and raise warnings if not met
  */
 private function checkDependencies()
 {
     // Register a micro autoloader for in-house engines
     spl_autoload_register(function ($className) {
         if (strpos($className, 'ImagePlus\\CropEngines\\') === false) {
             return;
         }
         $class = str_replace('ImagePlus\\CropEngines\\', '', $className);
         $path = realpath(dirname(__FILE__) . '/../cropengines/' . $class . '.php');
         if (is_readable($path)) {
             include $path;
         }
     });
     // Do some basic intelligent sniffing
     if (!isset($this->options['cropEngineClass'])) {
         if (CropEngines\PhpThumbsUp::engineRequirementsMet($this->modx)) {
             $this->options['cropEngineClass'] = '\\ImagePlus\\CropEngines\\PhpThumbsUp';
         } else {
             if (CropEngines\PhpThumbOf::engineRequirementsMet($this->modx)) {
                 $this->options['cropEngineClass'] = '\\ImagePlus\\CropEngines\\PhpThumbOf';
             }
         }
         if (!$this->options['cropEngineClass']) {
             // Handle unmet dependencies
             $this->options['hasUnmetDependencies'] = true;
             return true;
         }
     }
     $this->options['hasUnmetDependencies'] = false;
 }