--- imagecache.module +++ imagecache.module @@ -311,14 +311,23 @@ */ function imagecache_create_url($presetname, $filepath, $bypass_browser_cache = FALSE) { $path = _imagecache_strip_file_directory($filepath); - if (module_exists('transliteration')) { - $path = transliteration_get($path); - } - $args = array('absolute' => TRUE, 'query' => empty($bypass_browser_cache) ? NULL : time()); switch (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC)) { case FILE_DOWNLOADS_PUBLIC: - return url($GLOBALS['base_url'] . '/' . file_directory_path() .'/imagecache/'. $presetname .'/'. $path, $args); + + // Build the path including the preset name, and save a copy + $oldpath = $path = file_directory_path() .'/imagecache/'. $presetname .'/'. $path; + drupal_alter('file_url', $path); + + // If hook_file_url_alter did not change the output, then we need to add + // the base url. If it did, we can presume the path needs no modification. + if ($path == $old_path){ + $path = $GLOBALS['base_url'] . '/' . $path; + } + + // Even though our path here may have been altered, and point to a CDN or + // something, we still want to use url() so that bypass_browser_cache works + return url($path, $args); case FILE_DOWNLOADS_PRIVATE: return url('system/files/imagecache/'. $presetname .'/'. $path, $args); }