improved gallery (with source)

milianw - March 11, 2007 - 20:10

I don't know if this is the correct location to post this, but well - maybe you can point me to the correct one:

I've recently improved the gallery of the German kubuntu website and I want to share my code with you all.

You can see what it looks like here: http://www.kubuntu-de.org/bilder/events/chemnitzer-linux-tage-2007

The source code can be obtained on my page: http://milianw.de/misc/drupal-gallery.tar.bz2

What you have to do:

  • Unpack it in your theme folder
  • edit your template.php and add the following line:
    require_once('gallery_addon.php')
  • if you want a pagination in the detailed view, copy your node.php.tpl to node-image.php.tpl if you don't have such a file already and add the following line to the top:
    <?php if ($page != 0 && $terms) { $pager = custom_pager($node->nid); } ?>
    Now add these lines wherever you want to display the pagination:
      <?php if ($pager){ ?>
      <div class="pager">
        <?php echo $pager; ?>
      </div>
      <?php } ?>

That should be all! The pagination code is not written by me, I found it somewhere on this page.

I am interested about any sort of feedback. Also I'm curious if one would want to include some of this code in the core image module? Because I am somewhat convinced it is more usable than the default.

So long - Milian Wolff

I tried it in my 4.7

norio - March 18, 2007 - 18:12

I tried it in my 4.7 installation but I think this code only works with Drupal 5?

Would love to try a 4.7 version. Let me know if you ever make one.

4.7 version

milianw - March 20, 2007 - 16:26

uhm no I don't think that I'll write a 4.7 compliant version of this little plugin. It's my first script for drupal and hence I'm not aware of what changes might affect it. But you are free to do what ever you like with this code.

updated source code

milianw - March 20, 2007 - 18:59

I added an INSTALL.txt and fixed a bug with the pagination.
Also the images body text and title are now displayed in the gallery view.

You can download it all from the old location: http://milianw.de/misc/drupal-gallery.tar.bz2

updated for drupal 5.7 and newest image module

milianw - May 4, 2008 - 20:05

I've updated this little template-hack to work with drupal 5.7 and the newest image module. Get it here:

http://milianw.de/files/drupal-gallery-5.7.tar.bz2

 
 

Drupal is a registered trademark of Dries Buytaert.