? optional_absolute_paths.patch Index: imagecache.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache.module,v retrieving revision 1.112 diff -u -p -r1.112 imagecache.module --- imagecache.module 7 May 2009 15:15:04 -0000 1.112 +++ imagecache.module 25 May 2010 16:51:38 -0000 @@ -307,20 +307,23 @@ function imagecache_action_definition($a * @param $bypass_browser_cache * A Boolean indicating that the URL for the image should be distinct so that * the visitors browser will not be able to use a previously cached version. - * This is + * Defaults to FALSE. + * @param $absolute + * A Boolean indicating that the URL should be absolute. Defaults to TRUE. */ -function imagecache_create_url($presetname, $filepath, $bypass_browser_cache = FALSE) { +function imagecache_create_url($presetname, $filepath, $bypass_browser_cache = FALSE, $absolute = TRUE) { $path = _imagecache_strip_file_directory($filepath); if (module_exists('transliteration')) { $path = transliteration_get($path); } - $args = array('absolute' => TRUE, 'query' => $bypass_browser_cache ? time() : $bypass_browser_cache); + $args = array('absolute' => $absolute, 'query' => $bypass_browser_cache ? time() : $bypass_browser_cache); switch (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC)) { case FILE_DOWNLOADS_PUBLIC: - return url($GLOBALS['base_url'] . '/' . file_directory_path() .'/imagecache/'. $presetname .'/'. $path, $args); + $base = $absolute ? $GLOBALS['base_url'] .'/' : ''; + return url($base . file_directory_path() ."/imagecache/$presetname/$path", $args); case FILE_DOWNLOADS_PRIVATE: - return url('system/files/imagecache/'. $presetname .'/'. $path, $args); + return url("system/files/imagecache/$presetname/$path", $args); } } @@ -818,10 +821,12 @@ function _imagecache_recursive_delete($p * @param $getsize * If set to TRUE, the image's dimension are fetched and added as width/height * attributes. + * @param $absolute + * A Boolean indicating that the URL should be absolute. Defaults to TRUE. * @return * HTML img element string. */ -function theme_imagecache($presetname, $path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE) { +function theme_imagecache($presetname, $path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE, $absolute = TRUE) { // Check is_null() so people can intentionally pass an empty array of // to override the defaults completely. if (is_null($attributes)) { @@ -833,7 +838,7 @@ function theme_imagecache($presetname, $ } $attributes = drupal_attributes($attributes); - $imagecache_url = imagecache_create_url($presetname, $path); + $imagecache_url = imagecache_create_url($presetname, $path, FALSE, $absolute); return ''. check_plain($alt) .''; }