Wouldn't be great to have compatibility with lightbox2?.

Comments

jpetso’s picture

Yeah, totally. :P
Who wants to take this on?

gionnibgud’s picture

Hi, I had a look in to both imagefield and lightbox and I think that integration would be quite easyfor somebody with some skill but it has to be done by both modules.
If i got it right, lightbox module looks for specific classes in the img tag generated by an image module and applies the lightbox to the outside link. This happens for all the different image modules supported by lightbox module.
I guess that integration will work when: 1- imagefield will assign a lightbox class to imgs (and imgcache derivatives) 2- Lightbox will be able to recognize this class as a trigger.
Maybe a good start could be getting imagefield to add the class to the img. This would provide a class the user could add (manually) in the custom trigger section of the lightbox administration.
I'm not very advanced in my php but i think i can provide an example for the imagefield ->imagecache->lightbox (this reads thumbnail with lightbox):

filefield_imagecache.module line 64 :

$form['style'] = array(
        '#type' => 'select',
        '#title' => t('Display as'),
        '#description' => t('How the transformed image should appear.'),
        '#options' => array(
          'default'   => t('Transformed image'),
          'linked'    => t('Transformed image linked to node'),
          'imagelink' => t('Transformed image linked to original image'),
          'path'      => t('File path of transformed image'),
          'url'       => t('URL of transformed image'),
          'lighbox' => t('[Lightbox]Transformed image linked to original image'), // <======= this should add the choice to the dropdown
        ),
        '#default_value' => isset($file_formatter_settings['style'])
                            ? $file_formatter_settings['style']
                            : 'default',
        '#prefix' => '<div class="filefield-imagecache-formatter-style">',
        '#suffix' => '</div>',
      );

filefield_imagecache.module line 121 :

  switch ($style) {
    case 'linked':
      // We do have a node id because filefield merges $element['#item'].
      $imagetag = theme('imagecache', $presetname, $file->filepath, $description, $title);
      return l($imagetag, 'node/'. $file->nid,
              array('attributes' => array('class' => $classes), 'html' => TRUE));

    case 'imagelink':
      $original_image_url = file_create_url($file->filepath);
      $imagetag = theme('imagecache', $presetname, $file->filepath, $description, $title);
      return l($imagetag, $original_image_url,
              array('attributes' => array('class' => $classes), 'html' => TRUE));

    case 'url':
      return imagecache_create_url($presetname, $file->filepath);

    case 'path':
      return imagecache_create_path($presetname, $file->filepath);

    case 'lightbox': // <====== this is just the same as the case imagelink but adds a class to the img tag

    $original_image_url = file_create_url($file->filepath);
    $imagetag = theme('imagecache', $presetname, $file->filepath, $description, $title, array('class' => 'image-thumbnail'));
    return l($imagetag, $original_image_url, array('attributes' => array('class' => $classes), 'html' => TRUE));
        
     default:
      return theme('imagecache', $presetname, $file->filepath, $description, $title);
  }

)
Note: The class I used ('image-thumbnail') would work right away because it is already used by another image module (can't remember which) so no custom trigger configuration is needed.

I hope this is of any help.
cheers

bobek’s picture

I have done some testing, and it looks like, that adding 'rel' to href works better for me, because than I have valid groups of images on the front page (e.g. per node and not all images on the page grouped together).

    case 'lightbox':
      $original_image_url = file_create_url($file->filepath);
      $imagetag = theme('imagecache', $presetname, $file->filepath, $description, $title);
      return l($imagetag, $original_image_url, array('attributes' => array('class' => $classes, 'rel' => "lightbox[$file->nid]"), 'html' => TRUE));
gionnibgud’s picture

yes bobek definitively true, rel could be a better way but, from what i remember, lightbox module uses classes when integrating with other image modules.
We should check this out since, as i said, i might not remeber correctly.

Anyway here (http://drupal.org/node/144488) we have examples for all use cases.

Grouping should be implemented for a multiple value image filefield, that's for sure. Grouping on multiple value filed base would allow to have different galleries on the same node.
On the other side, 1 gallery->1 node, with some help from views module, would more or less give you the same result.

Also lightshow (lighbox slideshow) would be nice.

I also think that caption is quite important when showing lightbox so it should be taken into account too.

Last thing, I'm still convinced that most of this integration should be done on lightbox module side, more than on filefield image side.
Guess it's about time to post a feature request to lightbox mantainers, considering how popular this image module is becoming.
cheers

ar-jan’s picture

Agree, lightbox integration would be the best. I'm now using these tips http://drupal.org/node/274487 to have my thumbs popup in a grouped lightbox, but integration would be much nicer! (subscribe)

mariusooms’s picture

Hi, I was wondering if it would be possible to do the following with the rel array:

<?php
...'rel' => 'lightbox[$user->uid][<a href='/". $user->name ."/". $node->title ."'>$node->title</a>]'...
?>

Basically exposing the author to create a group and use the title as caption to create the node link. $node->title is available by default, but the uid or user->name are not. Could this work?

Kind regards,

Marius

mrgoltra’s picture

not sure if this comparison chart reflects version 6.

http://drupal.org/node/266126

jpetso’s picture

Status: Active » Closed (won't fix)

This module is now phased out in favor of FileField/ImageField 6.x-3.0. All issues are "won't fix" because the module is essentially dead. Please have a look at the project page for some explanations.