public function find($path) { try { $binaryFile = $this->ioService->loadBinaryFile($path); } catch (NotFoundException $e) { throw new NotLoadableException("Source image not found in {$path}", 0, $e); } $mimeType = $binaryFile->mimeType; return new Binary($this->ioService->getFileContents($binaryFile), $mimeType, $this->extensionGuesser->guess($mimeType)); }
public function find($path) { try { $binaryFile = $this->ioService->loadBinaryFile($path); // Treat a MissingBinaryFile as a not loadable file. if ($binaryFile instanceof MissingBinaryFile) { throw new NotLoadableException("Source image not found in {$path}"); } $mimeType = $this->ioService->getMimeType($path); return new Binary($this->ioService->getFileContents($binaryFile), $mimeType, $this->extensionGuesser->guess($mimeType)); } catch (NotFoundException $e) { throw new NotLoadableException("Source image not found in {$path}", 0, $e); } }
public function getFileContents(BinaryFile $binaryFile) { return $this->publishedIOService->getFileContents($binaryFile); }