Easy to update thumbnail gallery using Textpattern and Galleriffic
This tutorial assumes that you have a fairly strong understanding of HTML and CSS. I have provided a basic style sheet with all necessary styles to achieve the look of gallery demo, but please feel free to edit the css. We will be building a very simple updateable thumbnail gallery using Textpattern and Galleriffic. There are a few tutorials out there of a similar nature, but I have found this to be the simplest way to integrate Galleriffic with Textpattern.
Below is a screen capture of the final gallery. To see the gallery in action, click here

This tutorial assumes that you have textpattern installed and ready to go.
( Download the latest version of Textpattern here: http://textpattern.com/download)
Galleriffic
This gallery is based on Galleriffic, a jQuery plugin for rendering fast-performing photo galleries. This is adapted from http://www.twospy.com/galleriffic/ to work with textpattern so you (and your clients!) can easily update the gallery. In a nutshell, the gallery works by associating image id #s with a specific article. The article form gallery and article_image_form work together to render the article in the form of all of the associated images (in their thumbnail format) to appear as an unordered list on the left, while the full version of the current image appears on the right. All that is necessary to add or change images, is to change the numbered list appearing in the advanced options on the left of the article containing the images. So easy once implemented, even a client that doesn’t speak nerd can add, subtract or change their own images.
Upload the files
Upload both of the galleriffic files included in the files folder of the download, by uploading them through the Content > Files tab. I modified the jquery.galleriffic.js file so that the pagination does not appear above the thumbnails. Should you wish to further customize the gallery, I do suggest checking out the original Galleriffic demo.
Install the relevant plugins
Install the following plugins (these are included in the Plugins folder in the download):
- upm_image by Mary Fredbord – more powerful image display
- ebl-image-edit by Eric Limegrover – introduces advanced image editing functionality
(I have had technical issues with v.2 of this plugin, so I continue to use v1. Both are included in the plugin folder.)
ebl-image-edit is great for sizing/creating thumbnails on the fly, without having Textpattern automatically centre the thumbnail. It is not essential to this tutorial, but it’s very very handy!
![]()
Set up your forms
You can find these forms in the forms folder in the download.
gallery
Create a new form called “gallery” and choose “article” for the type:
<txp:upm_article_image form="article_image_form" wraptag="ul" class="thumbs noscript" />
article_image_form
Create a new form called “article_image_form” and choose “misc” for the type:
<li><a href="<txp:upm_img_full_url />" title="<txp:upm_img_caption />" class="thumb"><img src="<txp:upm_img_thumb_url />" alt="<txp:upm_img_alt />" /></a> <div> <div><txp:upm_img_alt /> </div> <div><txp:upm_img_caption /></div> </div> </li>
If you don’t want captions, delete the whole caption div.
Basically we have taken this code from galleriffic:
<ul> <li> <a href="path/to/slide" title="your image title"> <img src="path/to/thumbnail" alt="your image title again for graceful degradation" /> </a> <div> (Any html can go here) </div> </li> ... (repeat for every image in the gallery) </ul>
and modified it so the article forms generate this code from the image numbers that we will associate with the gallery article. We’re basically saying, “take the images associated with this article, put the thumbnail versions of those images on the left with these classes and this formatting, and put the full version of the selected image on the right.” Huh? Just follow along, I promise it will all make sense soon…
Set up your page
In the pages folder I have included a template for this gallery page (gallery.html). Create a new page template in textpattern: Presentation > Pages. At the bottom, “copy page as”, name it gallery, and click “copy.” Make sure whatever section you are using for the gallery is in fact using the gallery page as its template. At the bottom of the page you will notice the galleriffic script. This is where you can make adjustments to sizes, number of thumbnails, etc. In this example I have set a limit of 9 to the thumbnails. At the bottom of the page, near the top of the script, it looks like:
numThumbs: 9,
Set up your style
I have created a master style sheet that incorporates some of the Textpattern defaults as well as galleriffic specific css. Copy the content from the screen.css file provided in the Styles folder and paste it into your default styles tab under Presentation > Style.
Add your images
Go ahead and start uploading some images, and create some thumbnails. Make sure your images are all using the same size of thumbnail. Take note of the image ID numbers, as that is what you will use to call your images into the article. Make sure to add the Alt text and Caption when you upload, as this is what will appear to the left of the main image (unless you opted to delete the captions).

Create a new article called gallery. On the left hand side, click advanced options, and enter the ID numbers of the images you want to appear in the gallery, separated by commas. Make sure you post the article to the gallery section, or whichever section you have set up to display the gallery, and click publish. Your article should look something like this:

View Site. You should notice that the images have been automatically formatted into thumbnails on the left, with the first one appearing in full on the right. That’s it! You have a galleriffic gallery integrated with Textpattern. Play around with the html, settings, scripts and CSS to customize it to suit your own needs.
If you have any questions, suggestions, or requests for future articles, please do not hesitate to leave a comment.
Thanks, and happy coding!
Marie Poulin is a freelance graphic designer specializing in interactive design & strategy. She builds clean, usable websites using Textpattern, HTML and CSS. Twitter


I don’t know much about coding, so I am always really impressed when people have reigned in the beast of design via coding. Well done explaining the complex process to people who know very little about it (like myself!).
Marie, you wrote a great tutorial again. Since I’ve read your first tutorial, I’ve thought how use a jQuery gallery with Textpattern and now you wrote about that. And if you could write more articles about how use jQuery with Textpattern, it will be really helpful for people like me (completely beginner). Thanks.
Wow! Nicely done. :)
@Thiago – there are some other great tutorials for Textpattern over at “txptips.com”:http://www.txptips.com
Bugger. No textile.
http://www.txptips.com
Hello i am a beginner from sweden, looking for some help with this gallery, i know how to make a website, but i dont know how to install a javascript gallery on my website. is there anyone out there who wants to help me please?
btw, great tutorial but i dont understand what to do, i want it to work, i have tried with some galleries but i dont get it to work.
email me, anvar@imaxstudio.se
I can’t get this working :-(… I followed every step and at the end I get the following error message:
“Tag error: -> Textpattern Warning: tag does not exist on line 983″
It seems that upm_image plugin is not working with TXP 4.2… every time I try to load it appears this message:
Badly formed or empty plugin code.
I have not had a problem with that plugin in 4.2- are you sure you have copied and pasted it properly? You can find it in a few diff places on the web… try with: http://utterplush.com/txp-plugins/upm-image
This looks just what I’m trying to do with a gallery page, so thanks very much for the hard work and inspiration.
Still have not got it working though…….
A couple of questions:
1./ I too had the error message
‘Badly formed or empty plugin code.’
and again at the Version 1 of ebl-image-edit
The upm_image version at the link you provided did work though
Is there a stable version 1 of the ebl-image-edit anywhere?
2./ The CSS
Surely I have to create a separate file sheet for use by the gallery page to prevent every page being governed by the css sheet you provide?
(quote)I have created a master style sheet that incorporates some of the Textpattern defaults as well as galleriffic specific css. Copy the content from the screen.css file provided in the Styles folder and paste it into your default styles tab under Presentation > Style.(endquote)
so are you suggesting then saving this as say gallery.css and using it solely for the gallery page?
I’m fine with CSS but still getting my brain around how Textpattern works.
Stephen
Thanks in advance!
@Stephen
I can email you my ebl-image-edit? Keep in mind that plugin is not essential for this tutorial to work. you can still use textpattern to create a basic cropped thumbnail, or you can upload a thumbnail separately from the image.
As for the css- its really up to you. If you have a stylesheet that is already in place, just copy the relevant css from the gallery into your own stylesheet.
Alternately, as you said, you could have the gallery page call that css file.
I tend to stick to one css file, so I just move the relevant gallery-specific css into your existing css. (all the relevant gallery stuff is all grouped together, and should be pretty straightforward)… let me know if you have any trouble or need more clarification. (you can email me directly)
Cheers!
Thanks so much for the speedy and full response
I’ve gone for the untouched recreation of your example to see if I can set it up before I get creative with the CSS etc
I’ve tried this from scratch three times now and this is what I’m getting here:
http://www.mobilizingmouse.com/mobilizingmouse/gallery/
{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf540 {\fonttbl\f0\fswiss\fcharset0 Helvetica;} {\colortbl;\red255\green255\blue255;} \margl1440\margr1440\vieww9000\viewh8400\viewkind0 \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural \f0\fs24 \cf0 \ }
So since this is code being displayed is this an error in the ‘article_image_form’ or ‘gallery’ forms?
*** *** ***
Further digging about seems to suggest the error in in the syntax of the gallery file
Here’s a screenshot of the section as diagnosed with HyperEdit
http://www.mobilizingmouse.com/images/errors.jpg
This means I think that the scripts are not running and the images are not loading
I did validate the css after adding an escape at the end (*/)here
div.navigation {
/* The navigation style is set by a
javascript generated style on the page.
This is so that the javascript specific styles won’t be applied unless javascript is enabled. */}
Thanks for when you have a minute to look!
take care
Stephen
Hi Stephen,
Looking at your source code, I can see the error is in your article_image form, so it is not calling the thumbnails properly. Why don’t you email me directly and I can take a look? hello@mariepoulin.com
It also looks like your page is not properly linked to the javascript files. for example, you are linking to “/files/jquery.galleriffic.js” where you should be linking to “mobilizingmouse/files/jquery.gallerific.js” for both files…
Just to finish this thread off for anyone else who is trying to reproduce this gallery
With Marie’s help, here and behind the scenes, it’s all up and running just fine
http://www.mobilizingmouse.com/mobilizingmouse/gallery/
Now I’m just working on optimizing the file size vs quality for each picture
The steps polishing the code were simple and annoyingly small – missing a ‘/’ in the code as mentioned above for example
In creating this section it also improved my understanding of Textpattern
(It’s really quite a lot like SSI at its core)
Thanks again Marie for the inspiring tutorial
Stephen
For anyone using this and adding lots of pictures, just to add another tweak
When I got to about 65 images the whole set up stalled and wouldn’t load any more images
Arrrggghhhh, but then….
With help over at the Textpattern Forum it was identified that the Images box where the image numbers are entered had a 255 character limit
Assuming commas are characters…
1-9=18
10-89=237
18+237=255
So if numbers are consecutive the maximum number of images using this method without altering the VARCHAR is 89
I changed the VARCHAR in the database (don’t ask me, I’d never been in there before…..but I found it) to 500 or so and it worked fine
However in the end I simply set up linked gallery pages with 6 times 10 images in each – this makes the list of numbers more manageable
Take care
Stephen
This is a great, easy to follow tutorial, but I can’t get everything to work properly. I am able to load thumbnails and the javascript opacity hovers are working fine, but the large image doesn’t appear on the right side. If I click a thumbnail it loads the full-sized image in a new page. I’ve copied everything exact, all javascript files are loading and the code is identical to this tutorial and Stephen’s working online example. Any ideas?
Yes that was a stage I got to, with the images loading in a new window
I ‘think’ that was when Marie noticed this
It also looks like your page is not properly linked to the javascript files. for example, you are linking to “/files/jquery.galleriffic.js/” where you should be linking to “mobilizingmouse/files/jquery.gallerific.js/” for both files…
Look at this perhaps
Can you post a link to the page?
Stephen
Hey,
it would be helpful if you could post a link, but usually that is a sign that your jquery script has not been linked properly.
Check your url, see if the file is calling where you are telling it to call.
Send me a link, i’ll take a look!
Thanks for this tutorial, it’s straightforward and easy to use – as a Textpattern beginner, I struggle to understand some of the plugins, etc and it’s great to have a straightforward tutorial to work from.
I’m wondering if it would be possible to just pull all the images from an image category instead of designating the article image number?