Exemple #1
0
 protected function outputImage($path, $params)
 {
     try {
         // Output the image using glide server
         ob_clean();
         \CMF\Image::server()->outputImage($path, $this->getImageParams($params));
     } catch (\Exception $e) {
         // Output a placeholder - exception could mean file doesn't exist, or some other environment issue
         if (!\CMF\Image::server()->getSource()->has('assets/images/placeholder.png')) {
             \CMF\Image::server()->setSource(\CMF\Storage::adapter(CMFPATH . 'modules/image/public'));
         }
         \CMF\Image::server()->outputImage('assets/images/placeholder.png', array('w' => intval($params['w']), 'h' => intval($params['h']), 'bg' => 'efefef', 'fit' => 'fill'));
     }
 }