Index: imagefield.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/imagefield/imagefield.module,v retrieving revision 1.116 diff -u -r1.116 imagefield.module --- imagefield.module 10 Dec 2010 17:33:11 -0000 1.116 +++ imagefield.module 12 Dec 2010 19:35:35 -0000 @@ -345,19 +345,10 @@ $query_string = $query_character . $file['timestamp']; } - // Strip off the file directory path if present. - $path = $file['filepath']; - if (strpos($path, file_directory_path() .'/') === 0) { - $path = trim(substr($path, strlen(file_directory_path())), '\\/'); - } - - // Encode the parts of the path. - $parts = explode('/', $path); - foreach ($parts as $n => $part) { - $parts[$n] = rawurlencode($part); - } - $path = implode('/', $parts); + // Encode the path so that unusual characters are printed correctly. + $path = field_file_urlencode_path($file['filepath']); + // Construct the URL. $url = file_create_url($path) . $query_string; $attributes['src'] = $url; $attributes = drupal_attributes($attributes); @@ -382,17 +373,8 @@ } $thumb_path = imagefield_file_admin_thumb_path($item); - // Strip off the file directory path if present. - if (strpos($thumb_path, file_directory_path() .'/') === 0) { - $thumb_path = trim(substr($thumb_path, strlen(file_directory_path())), '\\/'); - } - - // Encode the parts of the path. - $parts = explode('/', $thumb_path); - foreach ($parts as $n => $part) { - $parts[$n] = rawurlencode($part); - } - $thumb_path = implode('/', $parts); + // Encode the path so that unusual characters are printed correctly. + $thumb_path = field_file_urlencode_path($thumb_path); // Add a timestamp to the URL to ensure it is immediately updated after editing. $query_string = '';