You are here

function theme_imagefield_admin_thumbnail in ImageField 6.3

1 theme call to theme_imagefield_admin_thumbnail()
theme_imagefield_widget_preview in ./imagefield.module

File

./imagefield.module, line 368

Code

function theme_imagefield_admin_thumbnail($item = NULL) {
  if (is_null($item) || empty($item['filepath'])) {
    return '<!-- link to default admin thumb -->';
  }
  $thumb_path = imagefield_file_admin_thumb_path($item);

  // 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 = '';
  if (isset($item['timestamp'])) {
    $query_character = variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE && variable_get('clean_url', '0') == '0' ? '&' : '?';
    $query_string = $query_character . $item['timestamp'];
  }
  return '<img src="' . file_create_url($thumb_path) . $query_string . '" title="' . check_plain($item['filename']) . '"  alt="' . t('Image preview') . '" />';
}