You are here

function theme_imceimage_image in Imce CCK Image 6

Same name and namespace in other branches
  1. 6.2 imceimage.module \theme_imceimage_image()

Theme an image

4 calls to theme_imceimage_image()
imceimage_process in ./imceimage.module
process handler for hook_elements renders the form element for imceimage.
theme_imceimage_formatter_default in ./imceimage.module
displays the image as an img
theme_imceimage_formatter_thumb in ./imceimage.module
displays the image as a link. given the class imceimage-link
theme_imceimage_formatter_with_caption in ./imceimage.module
displays the image as an img with caption

File

./imceimage.module, line 291

Code

function theme_imceimage_image($path, $width = '', $height = '', $alt = '', $title = '', $id = '') {

  //if is a blank image - deliver a blank image
  if ($path == '' || empty($path)) {
    $path = base_path() . drupal_get_path('module', 'imceimage') . '/includes/images/1x1.png';
  }

  //make sure that this is a valid image..
  $file_path = _imceimage_image_to_filepath($path);
  if (($info = image_get_info($file_path)) == false) {
    $path = base_path() . drupal_get_path('module', 'imceimage') . '/includes/images/warning.png';
    $alt = 'Image does not exist anymore or an invalid image';
    $width = 32;
    $height = 32;
  }
  $path = 'src="' . $path . '" ';
  $alt = 'alt="' . $alt . '" ';
  $title = 'title="' . $title . '"';
  $id = !empty($id) ? 'id="' . $id . '" ' : '';
  $width = !empty($width) ? 'width="' . $width . '" ' : '';
  $height = !empty($height) ? 'height="' . $height . '" ' : '';
  return '<img ' . $path . $alt . $title . $width . $height . $id . '/>';
}