/** * 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); }
/** * 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); }