From 3a84747496679a7949d674b56730e5b7427bd13c Mon Sep 17 00:00:00 2001 From: Robert Reinhard Date: Wed, 24 Jun 2015 09:21:17 -0700 Subject: [PATCH] Allow relativePath() to accept URLs --- src/Bkwld/Croppa/URL.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Bkwld/Croppa/URL.php b/src/Bkwld/Croppa/URL.php index c4a8cf5..e075194 100644 --- a/src/Bkwld/Croppa/URL.php +++ b/src/Bkwld/Croppa/URL.php @@ -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]; }