Skip to content

Commit

Permalink
Allow relativePath() to accept URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
weotch committed Jun 24, 2015
1 parent c72ed28 commit 3a84747
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Bkwld/Croppa/URL.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,14 @@ public function parse($request) {
}

/**
* Take the path with Croppa options removed and get the path relative
* to the crops_dir
* Take a URL or path to an image and get the path relative to the src and
* crops dirs by using the `path` config regex
*
* @param string $path
* @param string $url url or path
* @return string
*/
public function relativePath($path) {
public function relativePath($url) {
$path = $this->toPath($url);
preg_match('#'.$this->config['path'].'#', $path, $matches);
return $matches[1];
}
Expand Down

0 comments on commit 3a84747

Please sign in to comment.