Skip to content

Commit

Permalink
Merge pull request #65 from fixe/patch-1
Browse files Browse the repository at this point in the history
Throwing an error if source image doesn't exist
  • Loading branch information
lsmith77 committed Apr 14, 2012
2 parents 0ee7a14 + e629756 commit 94afe1b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Imagine/Data/Loader/FileSystemLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public function __construct(ImagineInterface $imagine, $formats, $rootPath)
*/
protected function getFileInfo($absolutePath)
{
if (!file_exists($absolutePath)) {
throw new NotFoundHttpException(sprintf("Source image '%s' doesn't exist", $absolutePath));
}

return pathinfo($absolutePath);
}

Expand All @@ -61,7 +65,8 @@ public function find($path)
throw new NotFoundHttpException(sprintf("Source image was searched with '%s' out side of the defined root path", $path));
}

$info = $this->getFileInfo($this->rootPath.'/'.ltrim($path, '/'));
$file = $this->rootPath.'/'.ltrim($path, '/');
$info = $this->getFileInfo($file);
$absolutePath = $info['dirname'].'/'.$info['basename'];

$name = $info['dirname'].'/'.$info['filename'];
Expand Down

0 comments on commit 94afe1b

Please sign in to comment.