Posted by AD-DA on February 23, 2009 at 1:30am
1 follower
Jump to:
| Project: | Imce CCK Image |
| Version: | 6.x-1.0-beta1 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Would it be possible to add a display option to enable the integration of Lightbox?
I have overridden the display function in my template, it would be easy to reuse this on a new display option:
<?php
function phptemplate_imceimage_formatter_thumb($element) {
$item = $element['#item'];
$field = $element['#field_name'];
$delta = $element['#delta'];
$id = "imceimage-". $field ."-". $delta . '-thumb';
$thumb = _imceimage_get_thumb($item);
/* Add a check on the image path, avoid displaying an empty image */
if ($item['imceimage_path']){
$thumbimage = theme_imceimage_image($thumb['imceimage_path'], $thumb['imceimage_width'],$thumb['imceimage_height'],$thumb['imceimage_alt'],$id);
$rel_link="lightbox[imce_gallery][<a href=\"" .base_path() . drupal_get_path_alias("node/" . $element['#node']->nid) . "\">Show details</a>]";
return '<a class="imceimage-link" href="' . $item['imceimage_path'] .'" rel=\'' . $rel_link . '\' >' . $thumbimage . '</a>';
}
else {
return '';
}
}
?>I've also added the test on the imagepath to prevent the display of a blank image.
Comments
#1
Forgot to explain that as I use this display mode in Views results, I have added a Lightbox option which link to the node which holds the image which is being displayed. This is an easy way to generate a Gallery of pictures from nodes with IMCE Images.
So the $rel_link could be:
1. For simple Lightbox display
<?php$rel_link="lightbox";
?>
2. For Lightbox display in a gallery
<?php$rel_link="lightbox[imce_gallery]";
?>
3. For Lightbox display in a gallery, with link to the node which holds the image:
<?php$rel_link="lightbox[imce_gallery][<a href=\"" .base_path() . drupal_get_path_alias("node/" . $element['#node']->nid) . "\">Show details</a>]";
?>