public function imageUrl($url = null) { $result = parent::assetUrl($url, array('pathPrefix' => IMAGES_URL)); // if end with / we remove the timestamp if (substr_compare($url, '/', -1, 1) === 0) { $result = preg_replace('/\?.*/', '', $result); } return $result; }
public function assetUrl($path, $options = array()) { $this->getLocale(); $useCDN = false; if (!empty($options['pathPrefix']) && in_array($options['pathPrefix'], array("js/", "css/", "img/", "files/"))) { if (in_array($options['pathPrefix'], array("img/", "files/"))) { $options['pathPrefix'] = "s/{$this->version}/resources/" . $this->getLocale() . $options['pathPrefix']; // TODO: This min folder can be used if using grunt uglify:younique_js or grunt build // } elseif (defined('USE_CDN') && USE_CDN === TRUE && in_array($options['pathPrefix'], ['js/'])) { // $options['pathPrefix'] = "s/{$this->version}/min/" . $options['pathPrefix']; } else { $options['pathPrefix'] = "s/{$this->version}/" . $options['pathPrefix']; } $useCDN = true; } $url = parent::assetUrl($path, $options); if ($useCDN && defined('USE_CDN') && USE_CDN === TRUE) { $url = "https://d2lu29c1rbtr6s.cloudfront.net/" . ltrim($url, "/"); } return $url; }