diff --git a/src/Mmanos/Casset/Container.php b/src/Mmanos/Casset/Container.php index ca5662c..6a454d8 100644 --- a/src/Mmanos/Casset/Container.php +++ b/src/Mmanos/Casset/Container.php @@ -212,13 +212,26 @@ public function image($source, $alt = null, $attributes = array()) $url = $source; if (false === strstr($source, '://') && '//' !== substr($source, 0, 2)) { - $url = str_ireplace($this->public_path, '', $this->assets_path . '/' . ltrim($source, '/')); - $url = $this->cdn ? $this->cdn . $url : $url; + $url = $this->cdn($source); } return \HTML::image($url, $alt, $attributes); } + /** + * Get the URL to the CDN for an asset. + * + * @param string $source + * + * @return string + */ + public function cdn($source) + { + $url = str_ireplace($this->public_path, '', $this->assets_path . '/' . ltrim($source, '/')); + $url = $this->cdn ? $this->cdn . $url : $url; + return $url; + } + /** * Add a global dependency. *