You are here

function _fupload_imagepreview in Image FUpload 6.3

Same name in this branch
  1. 6.3 includes/images.previewlist.inc \_fupload_imagepreview()
  2. 6.3 includes/images.previewlist.image.inc \_fupload_imagepreview()
Same name and namespace in other branches
  1. 6 includes/images.previewlist.inc \_fupload_imagepreview()
  2. 6.2 includes/images.previewlist.inc \_fupload_imagepreview()
2 calls to _fupload_imagepreview()
fupload_list_images in includes/images.previewlist.inc
fupload_list_images_image in includes/images.previewlist.image.inc

File

includes/images.previewlist.inc, line 119

Code

function _fupload_imagepreview($node_image, $node_type) {
  $image_node_types = variable_get('image_node_types', array());
  $attributes = variable_get('fupload_previewlist_img_attributes', '');

  /** need to split image module and other cck related imagemodules to be able to provide the right
   *     preview handling
   */
  switch ($node_type) {
    case 'image':

      // image module
      if (!empty($image_node_types['image']['imagecache_preset'])) {

        // using ImageCache
        $content = theme('imagecache', $image_node_types['image']['imagecache_preset'], $node_image->images['_original'], $node_image->title, $node_image->title, $attributes);
      }
      else {

        // using a ready-to-use Image size of Image module
        $image = $node_image->images[$image_node_types['image']['image_selection']];
        $content = theme('fupload_imagepreview_img', $image, image_get_info($image), $node_image, $attributes);
      }
      break;
    default:

      // imagefield cck module
      if (!empty($image_node_types[$node_type]['imagecache_preset'])) {

        // using ImageCache
        $field_name = $image_node_types[$node_type]['fieldname'];
        $image = $node_image->{$field_name};
        $content = theme('imagecache', $image_node_types[$node_type]['imagecache_preset'], $image[0]['filepath'], $node_image->title, $node_image->title, $attributes);
      }
      break;
  }
  return $content;
}