iaian7 » code » txp   John Einselen, 7.01.07 (updated 10.04.11)    

an7_img is a Textpattern plugin used for image insertion and simplified integration of any standard Lightbox style script. It was originally designed for use with Tyler Mulligan’s Litebox, but works well with Slimbox, or any other script that follows the same usage guidelines. Textpattern image IDs are not supported, but using a folder system makes image management fairly intuitive, and a heck of a lot easier than Textpattern’s image handling. The following are examples of the three different tags.

<txp:an7_imgdir dir="examples/an7img/" />

These first two tags use a Lightbox script to open images in a floating div, along with a dark overlay to the site. Only the image folder path is needed for this tag, as it will automatically find each file (and corresponding thumbnail in the thumbs/ subdirectory) and add them to an image set. The images are navigated as a group in the Lightbox display, even allowing keyboard shortcut controls (with most Lightbox scripts, that is).

<txp:an7_imgbox dir="examples/an7img/" img="img1.jpg" />

Similar usage as the above tag; merely specify the directory path and the file name of the image you want inserted into the page. You can also use css floating for the thumbnail by adding float=“value”. Litebox images are automatically grouped into galleries based on the Textpattern article ID. This can be changed on a per image basis by using set=“value”, or the global default can be changed in the plugin (which would cause all images on a page to be grouped together, regardless of the articles they belong too).

<txp:an7_img dir="examples/" img="img1.jpg" />

Inserts just the image (no thumbnail, no script) into the post. Maybe not that useful in many cases, and while this tag automatically adjusts settings for the image size, the real advantage is in its similarity to an7_imgbox; letting you switch between the two with the addition or subtraction of three letters.

tag options

dir="folder/" — required value for all tags

img="image.jpg" — required value for imgbox and img only

set="galleryset" — option for imgdir and imgbox. plugin default uses the Textpattern article ID

alt="image discription" — option for the image alt text, default is blank. when used with imgdir, it uses the text for all images

class="" — class for imgdir container DIV or img image. defaults are “litebox” and “img” respectively

classthumb=""CSS class for imgdir thumbanils or imgbox thumbnails. defaults are “liteboxthumb”

float="" — sets CSS floating for the DIV container (imgdir), thumbnail (imgbox), or image (img). default is “none”


an7_img (version 0.4)
Litebox (external page)
Slimbox (external page)


Open the textpattern plugin file in your browser and copy / paste the text into your Textpattern “install plugin” field (Admin > Plugins). Everything should work beautifully.

Follow the Lightbox script installation notes from the official site. Personally, I’ve always kept a js/ folder in my root directory, but you can do it differently. Just make sure any changes are noted and updated! Also, don’t forget to correctly link everything in your Textpattern page headers, and add any required onload=“initLightbox()” lines to your page’s html code.

The plugin itself doesn’t need much configuration, though you’ll need to edit the plugin to accommodate your specific server setup (just to correct any image link issues when using clean or messy URLs, you shouldn’t run into many problems if you’re running in the root directory of the domain).

version history

Please help improve this plugin by reporting errors, issues, or comments via email.

— added “base” setting, consistent with an7_mov and an7_media
— fixed image sets; uses the article ID when set to “id”
— fixed space between thumbnails in a directory tag
— added CSS option to remaining tags
— corrected tag listing “an7_dir” to “an7_imgdir” in the help file
— first publicized version
— fixed clean URL setup and added pre=”“ values
— added CSS float option for “an7_imgbox”
— beta release
— fixed directory function
— fixed display errors
— alpha release, buggy beyond comprehension

help and support

Full instructions and tag options are listed in the Help file within the plugin.

The plugin has only been tested with Litebox and Slimbox, others should be compatible, but there aren’t any guarantees.

And I appologize, I’m terrible with PHP. There’s a million and one ways I can mess this stuff up, but I’ve done my best to keep it nice and simple. All of my plugins are designed for specific issues and solutions in my own work (and my own file management styles), so I can’t say they’ll work just as wonderfully for you.

For questions and support, please visit the an7_img post in the Textpattern Forums.


The tutorials from tutorials were of invaluable help, and I borrowed code snippets from lixlpixel. When I couldn’t get the directory code to work, Eli Ihms stepped in to make it all better. Thanks!

florian, 2.07.07

i have a problem with the plugin …

texpattern is installed on “” but the images schould be load from “” ... what must i change to get it work?

(sorry for my bad english emoticon )

Iaian7, 3.07.07

You can use the pre="" attribute to set an offsite source.

Instead of pre="/", as for a clean URL setup in textpattern, set pre="" for each tag use. Alternately, the plugin code for the 'pre' => '/', attribute can be edited, resetting the global default to your offsite image folder.

zeus, 27.02.08

trying to use ur plug in but not sure if i’m allowed to nest the