Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

move some code out into getFileInfo()

  • Loading branch information...
commit c9166122782a610806441ccab2c5279748694344 1 parent df16075
@lsmith77 lsmith77 authored
Showing with 15 additions and 3 deletions.
  1. +15 −3 Imagine/Data/Loader/FileSystemLoader.php
View
18 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)
Please sign in to comment.
Something went wrong with that request. Please try again.