Permalink
Browse files

move some code out into getFileInfo()

  • Loading branch information...
1 parent df16075 commit c9166122782a610806441ccab2c5279748694344 @lsmith77 lsmith77 committed Mar 7, 2012
Showing with 15 additions and 3 deletions.
  1. +15 −3 Imagine/Data/Loader/FileSystemLoader.php
@@ -38,6 +38,19 @@ public function __construct(ImagineInterface $imagine, $formats, $rootPath)
}
/**
+ * Get the file info for the given path
+ *
+ * This can optionally be used to generate the given file
+ *
+ * @param $absolutePath
+ * @return array
+ */
+ protected function getFileInfo($absolutePath)
+ {
+ return pathinfo($absolutePath);
+ }
+
+ /**
* @param string $path
*
* @return Imagine\Image\ImageInterface
@@ -48,9 +61,8 @@ public function find($path)
throw new NotFoundHttpException(sprintf("Source image was searched with '%s' out side of the defined root path", $path));
}
- $absolutePath = $this->rootPath.'/'.ltrim($path, '/');
-
- $info = pathinfo($absolutePath);
+ $info = $this->getFileInfo($this->rootPath.'/'.ltrim($path, '/'));
+ $absolutePath = $info['dirname'].'/'.$info['basename'];
$name = $info['dirname'].'/'.$info['filename'];
$targetFormat = empty($this->formats) || in_array($info['extension'], $this->formats)

0 comments on commit c916612

Please sign in to comment.