You are here

function theme_linkimagefield_image in Link Image Field 5

Same name and namespace in other branches
  1. 6 linkimagefield.module \theme_linkimagefield_image()
3 theme calls to theme_linkimagefield_image()
linkimagefield_field_formatter in ./linkimagefield.module
Implementation of hook_field_formatter().
theme_linkimagefield_view_image in ./linkimagefield.module
_linkimagefield_widget_form in ./linkimagefield.module

File

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

Code

function theme_linkimagefield_image($file, $alt = '', $url_link = '', $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;

    //$url_link;
    $title = empty($title) ? $file['title'] : $title;
    $url = file_create_url($path);
    $url_link = url($url_link);
    return '<a href="' . $url_link . '"><img src="' . check_url($url) . '" alt="' . check_plain($alt) . '" title="' . check_plain($title) . '" ' . $image_attributes . $attributes . ' /></a>';
  }
}