function theme_imagefield_image in ImageField 5
Same name and namespace in other branches
- 5.2 imagefield.module \theme_imagefield_image()
- 6.3 imagefield.module \theme_imagefield_image()
3 theme calls to theme_imagefield_image()
- imagefield_field_formatter in ./
imagefield.module - Implementation of hook_field_formatter().
- theme_imagefield_view_image in ./
imagefield.module - _imagefield_widget_form in ./
imagefield.module
File
- ./
imagefield.module, line 622 - 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 (!$getsize || is_file($file['filepath']) && (list($width, $height, $type, $image_attributes) = @getimagesize($file['filepath']))) {
$attributes = drupal_attributes($attributes);
$path = $file['fid'] == 'upload' ? $file['preview'] : $file['filepath'];
$alt = empty($alt) ? $file['alt'] : $alt;
$title = empty($title) ? $file['title'] : $title;
$url = $file['fid'] == 'upload' ? url($file['preview']) : file_create_url($path);
return '<img src="' . check_url($url) . '" alt="' . check_plain($alt) . '" title="' . check_plain($title) . '" ' . $image_attributes . $attributes . ' />';
}
}