Lightbox/colorbox slideshow and trigger thumbnails I a have problem getting a slideshow and colorbox to play together.

How would you go if you wanted to:


have a set of images in a node (let's say it's a multi-value image field)
display just a single thumbnail as a colorbox trigger
open up a colorbox with a slideshow of all images in that field.


The thing I want to emphasize is the distinction between having a single thumbnail on a node display level, and the slideshow on a colorbox level. By saying 'colorbox' I mean not necessarily that particular plugin/module. I'm open to any working solution, however I must say I gave up Lightbox2 after I found it poorly configurable.
I found my way of doing this. It's a litle bit tricky, but I hope it helps.

1) Get a View where you grab all node's fields, one of them is the "image" (multi-value).

2) To create a Custom Formatter with the Field API, put this code in a custom module (e.g. mymodule):

/**
* Implements hook_field_formatter_info().
*/
function mymodule_field_formatter_info() {
  return array(
    'mymodule_formatter' =&gt; array( //Machine name of the formatter
      'label' =&gt; t('Links to images'),
      'field types' =&gt; array('image'), //This will only be available to text fields
    ),
  );
}


/**
* Implements hook_field_formatter_view().
*/
function mymodule_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array(); // Initialize the var
  $settings = $display['settings']; // get the settings

  //get first image
  $firstimg = $items[0];
  $uri = file_create_url(file_load($firstimg['fid'])-&gt;uri);
  $html = '&lt;img src="'. $uri. '" id="galeria1-button" class="btnSlideshow" href="#" /&gt;'. PHP_EOL;

  //get all images and put them as links but without being seen
  $options = array(
    'html' =&gt; TRUE, // This tells Drupal that we're sending HTML, not plain text, otherwise it would encode it
    'attributes' =&gt; array(
      'class' =&gt; 'galeria1',
    ),
  );
  foreach ($items as $delta =&gt; $item) {
    $uri = file_create_url(file_load($item['fid'])-&gt;uri);
    $html.= l('&amp;nbsp;', $uri, $options);
  }

  //js will make that when you click on first image its as if you were clicking on first gallery image
  drupal_add_js('jQuery(document).ready(function(){jQuery("#galeria1-button").click(function(){jQuery(".galeria1").filter(":first").click();}); jQuery(".galeria1").colorbox({rel:\'galeria1\'});});', 'inline');

  $elements[0] = array('#markup' =&gt; $html);

  return $elements;
}