Simple image gallery using imagefield and javascript

imagegallery.jpg

Step 1: Copy "thumbnailviewer2.js" into js folder inside theme

Setp 2: Add code below inside template.php for that theme

drupal_add_js(drupal_get_path('theme', 'tapestry') . '/js/thumbnailviewer2.js', 'theme');

Step 3: Modify code below as needed and paste it it inside node.tpl.php

<?php if ($node->field_photo[0]['view']): ?>
<a href="<?php print base_path() ?>files/imagecache/featured/<?php print $node->field_photo[0]['filepath'] ?>" rel="enlargeimage::click" rev="loadarea"><?php print theme('imagecache', 'featuredsmall', $node->field_photo[0]['filepath'], $alt = $node->field_photo[0]['alt'], $title = $node->field_photo[0]['title']) ?></a>
<?php endif; ?>
 
<?php if ($node->field_photo[1]['view']): ?>
<a href="<?php print base_path() ?>files/imagecache/featured/<?php print $node->field_photo[1]['filepath'] ?>" rel="enlargeimage::click" rev="loadarea"><?php print theme('imagecache', 'featuredsmall', $node->field_photo[1]['filepath'], $alt = $node->field_photo[1]['alt'], $title = $node->field_photo[1]['title']) ?></a>
<?php endif; ?>
 
<?php if ($node->field_photo[2]['view']): ?>
<a href="<?php print base_path() ?>files/imagecache/featured/<?php print $node->field_photo[2]['filepath'] ?>" rel="enlargeimage::click" rev="loadarea"><?php print theme('imagecache', 'featuredsmall', $node->field_photo[2]['filepath'], $alt = $node->field_photo[2]['alt'], $title = $node->field_photo[2]['title']) ?></a>
<?php endif; ?>
 
<div id="loadarea" style="width: 550px"><?php print theme('imagecache', 'featured', $node->field_photo[0]['filepath'], $alt = $node->field_photo[0]['alt'], $title = $node->field_photo[0]['title']) ?></div>

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <b> <address> <blockquote> <br> <caption> <center> <code> <dd> <del> <div> <dl> <dt> <em> <font> <h2> <h3> <h4> <h5> <h6> <hr> <i> <img> <li> <ol> <p> <pre> <span> <strong> <sub> <sup> <table> <tbody> <td> <tfoot> <th> <thead> <tr> <u> <ul> <tr>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]".
  • Use the special tag [adsense:format:group:channel] or [adsense:block:location] to display Google AdSense ads.

More information about formatting options

To combat spam, please enter the code in the image.