You are here

function theme_imagefield_image in ImageField 5.2

Same name and namespace in other branches
  1. 5 imagefield.module \theme_imagefield_image()
  2. 6.3 imagefield.module \theme_imagefield_image()
4 theme calls to theme_imagefield_image()
imagefield_field_formatter in ./imagefield.module
Implementation of hook_field_formatter().
imagefield_field_settings in ./imagefield.module
Implementation of hook_field_settings().
theme_imagefield_view_image in ./imagefield.module
_imagefield_widget_form in ./imagefield.module

File

./imagefield.module, line 1039
Defines an image field type. imagefield uses content.module to store the fid, and the drupal files table to store the actual file data.

Code

function theme_imagefield_image($file, $alt = '', $title = '', $attributes = null, $getsize = true) {
  $file = (array) $file;
  if (!is_file($file['filepath'])) {
    return;
  }
  if (!$getsize || (list($width, $height, $type, $image_attributes) = @getimagesize($file['filepath']))) {
    $attributes = drupal_attributes($attributes);
    $url = $file['fid'] == 'upload' ? url($file['preview']) : file_create_url($file['filepath']);
    $alt = empty($alt) ? $file['alt'] : $alt;
    $title = empty($title) ? $file['title'] : $title;
    return '<img src="' . check_url($url) . '" alt="' . check_plain($alt) . '" title="' . check_plain($title) . '" ' . $image_attributes . $attributes . ' />';
  }
}