Ejemplo n.º 1
0
 /**
  * Get a manipulable image instance.
  *
  * @param string $file the image path
  *
  * @return ImageHandler a manipulable image instance
  */
 public function open($file)
 {
     if (strlen($file) >= 1 && $file[0] == '@') {
         $file = $this->fileLocator instanceof FileLocatorInterface ? $this->fileLocator->locate($file) : $this->fileLocator->locateResource($file);
     }
     return $this->createInstance($file);
 }
Ejemplo n.º 2
0
 /**
  * Get a manipulable image instance.
  *
  * @param string $file the image path
  *
  * @return ImageHandler a manipulable image instance
  */
 public function open($file)
 {
     if (strlen($file) >= 1 && $file[0] == '@') {
         try {
             if ($this->fileLocator instanceof FileLocatorInterface) {
                 $file = $this->fileLocator->locate($file);
             } else {
                 $this->fileLocator->locateResource($file);
             }
         } catch (\InvalidArgumentException $exception) {
             if ($this->throwException || false == $this->fallbackImage) {
                 throw $exception;
             }
             $file = $this->fallbackImage;
         }
     }
     return $this->createInstance($file);
 }