Screencast: Creating and Theming a Node Photo Gallery with Drupal 7 and Colorbox
Sep
16
2011
Recently, I designed, themed and developed a new site for my photography, High Rock Photo. The obvious choice for this new site was to use Drupal 7. I wanted the ability to easily create node galleries and this screencast shows you how to create and theme a node photo gallery using Drupal 7. I will also point out what modules are needed and make reference to those that would have been used in Drupal 6 and are now integrated into core in Drupal 7. You will also find some custom template code published that I mention in the video for your theming.
Template Code (Drupal 7)
field--field_gallery_photo.tpl.php » /sites/all/themes/[your_theme]/templates/
- <?php
- /*
- template - drupal.org/node/1224106#comment-4969404
- Photo title - drupal.org/node/432846#comment-4125056
- used at: www.highrockphoto.com
- /*
- /* change the column count to the number of photos you want to appear going across. (Adjust thumbnail size as needed) */
- $columns = 2;
- $rows = array_chunk($items, $columns);
- ?>
- <table class="mini-gallery">
- <tbody>
- <?php foreach ($rows as $row_number => $columns): ?>
- <?php
- $row_class = 'row-' . ($row_number + 1);
- if ($row_number == 0) {
- $row_class .= ' row-first';
- }
- if (count($rows) == ($row_number + 1)) {
- $row_class .= ' row-last';
- }
- ?>
- <tr class="<?php print $row_class; ?>">
- <?php foreach ($columns as $column_number => $item): ?>
- <td class="<?php print 'col-'. ($column_number + 1); ?>">
- <div class="photo-image"><?php print render($item); ?></div>
- <div class="photo-title"><?php print($item['#item']['title']); ?>
- <div>
- </td>
- <?php endforeach; ?>
- </tr>
- <?php endforeach; ?>
- </tbody>
- </table>


love this tutorial
I really loved this tutorial and the overall layout/appearance of the gallery, this is exactly what I have been looking for. The one thing I would really love to be able to add is the ability to have an 'add photo' button to each gallery so a user could simply upload a photo to it. Do you know if there is a simple way to go about that?
Thanks!
Lance
Just thanks
Nice tutorial.
Alan
Thanks for the screencast,
Thanks for the screencast, I'm sure a lot of people will find it interesting.
Here is a module that might interest you: http://drupal.org/project/galleryformatter
Thanks, I'll take a look at
Thanks, I'll take a look at that module.
Nice article, thanks.
Nice article, thanks.
Can't wait to delve into this
Jumping into the D7 water. Had been using Menalto Gallery2 on my D6 site. Thanks for posting this, I need to learn more about the template files.
Cheers
Right what the doctor ordered
Thank you for sharing this with us.
It's an excellent tutorial and got me exactly what I needed.
Thanks again.
For some reason I can't
For some reason I can't choose for gallery in "manage display". Any ideas what I could do?
Hi something is not right
Hi something is not right with your configuration, can you watch the screencast again and make sure you followed all the steps?
Great Tutorial, i love it.
Great Tutorial, i love it. The best way to build a photogallery in Drupal 7, because other module ends in result of a crash and made for Drupal 6 only.
Thanks so much
Thank you from spain,
Thank you from spain,
Great Information
Thanks for this interesting article! I found it very interesting. You really make it seem so easy with your presentation.
Thank you for the screencast!
Thank you for the screencast! I'm finding this post extremely useful for me as I'm just working now on creating a node photo gallery.
Excelent Work, but?
Excelent work, but what we can do if we have do upload 150 pictures? Do you have any ideia?
Thanks
RC
Hi yes, that is possible. You
Hi yes, that is possible. You would need to use these modules:
http://drupal.org/project/plupload (plupload)
and
http://drupal.org/sandbox/vingborg/1138512 (Mupload)
It's a little tricky getting this all to work but once you do you can upload multiple files at once. I want to do a screencast on it but have not had time. :(
Post new comment