Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-03-12 02:57:52

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,413
Website GitHub

smd_gallery: super-flexible gallery generator

If you’ve tried all the easy galleries (wet_for_each_image, upm_image, smd_slimbox, rss_thumbpop, aro_slideshow, etc) or crave something a little more esoteric or complicated, this might just be the plugin for you.

It uses a souped-up database engine from smd_slimbox combined with the power of wet_for_each_image and a few things besides so you can pluck stuff from the database (or, still untested, from directories) and use a form to render the output to fit your devious needs.

Can emulate slimbox, lightbox, thickbox, litebox, moonbox, fancyzoom, thumbpop, tooltips, slideshow, yahde yahde, and more as they are invented. Detailed instructions and examples are in the plugin help, and there is more info on the beta page.

Download smd_gallery | requires smd_lib

Possible feature enhancements

In no particular order:

  • Random image option (sorry masa, it’s more involved than I thought because it’s stepping thru the images one by one I can’t just pluck one out randomly until it’s been through them all)
  • Combine the normal and collate modes, offering an optional 3rd form dedicated to collation if required
  • Find a way to ‘split’ the output; currently, if you want parts of the output in two places it requires two calls
  • Conditional output (perhaps enhancements to smd_if will help) Mostly achieved with v0.4

These are by no means guaranteed and may never see the light of day. But if anyone has any brainy nuggets to offer, feel free to speak up.

As ever, please leave feedback here: good, bad or indifferent, and enjoy pushing this one to the max.

Revision history
————————

All available versions and changes are listed here. Each entry indexes the relevant post(s) in the threads to learn about the features.

Last edited by Bloke (2010-04-06 18:03:05)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#2 2008-03-12 05:49:11

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

Re: smd_gallery: super-flexible gallery generator

Bloke wrote:

Random image option (sorry masa, it’s more involved than I thought because it’s stepping thru the images one by one I can’t just pluck one out randomly until it’s been through them all)

No worries, it has so many other, interesting options.
I’m working around it by simply using the article image as the placeholder:
<txp:article_image html_id="fullsize" thumbnail="0" />

Not random, but easy enough.

You did an excellent job on the documentation and thanks for the detailed samples! :-)

Last edited by masa (2008-03-12 06:04:43)

Offline

#3 2008-03-15 09:25:45

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: smd_gallery: super-flexible gallery generator

Bloke, looks like a great plugin. As expected :-) How would you go about creating a multi-gallery on one page? For example, work, travel and animals galleries, separated on a page. Trying to understand the best way to achieve this with the minimum code.

Offline

#4 2008-03-15 10:23:05

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,413
Website GitHub

Re: smd_gallery: super-flexible gallery generator

jstubbs wrote:

How would you go about creating a multi-gallery on one page? For example, work, travel and animals galleries, separated on a page…. with the minimum code.

Depending if you want to lightbox stuff the form will become a tad more complex, but for a simple list of all thumbs in those categories the minimum code is probably:

Tag:

<txp:smd_gallery category="work, travel, animals" wraptag="div" class="thumbs" form="multigal" />

Form multigal:

<txp:if_different>
<h3>{category}</h3>
</txp:if_different>

<span class="animage">
 {object}
</span>

Style:

.animage {
  width:100px;
  height:100px;
  padding:10px;
}

How’s that for starters? The only thing I’ve spotted is that the category is the ‘internal’ name not the ‘display’ title. If that’s a problem I could probably find a way of extracting the title too and making it available.

Last edited by Bloke (2008-03-15 10:23:18)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 2008-03-15 10:38:27

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: smd_gallery: super-flexible gallery generator

Thanks Stef I will try that out a little later today. I think I might try the Fancy Zoom on this gallery. One small thing you may have noticed (or not) – I installed the plugin and set it to active. On the same site, I have smd_slimbox activated.

Visiting the gallery page, I noticed a PHP error. Seems both plugins can’t be active at the same time.

Offline

#6 2008-03-15 11:39:06

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,413
Website GitHub

Re: smd_gallery: super-flexible gallery generator

jstubbs wrote:

Visiting the gallery page, I noticed a PHP error. Seems both plugins can’t be active at the same time.

Odd, I have smd_slimbox, smd_lib, smd_random_banner and smd_gallery on my test site and they co-exist fine. Which versions of the plugins are you using (I assume it’s a 4.0.6 TextPattern too)?

However, I did spot a few silly undefined index warnings on one of my v4.0.5 installs that don’t show up under v4.0.6 (which I developed on), so thanks for highlighting them. It’s totally bizarre because they’re fundamental errors and should show up on both systems but they don’t.

Regardless, I’ve fixed those and also added {category_title} as a replacement tag to show the image category Title instead of its Name.

Try v0.31 [ compressed version ] and see if that fixes it.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2008-03-15 11:48:59

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: smd_gallery: super-flexible gallery generator

Error message is the following:


Fatal error: Cannot redeclare smd_addqsvar() (previously declared in /users/home/jstubbs/domains/mydomain.com/web/public/textpattern/lib/txplib_misc.php(574) : eval()'d code:669) in /users/home/jstubbs/domains/mydomain.com/web/public/textpattern/lib/txplib_misc.php(469) : eval()'d code on line 16

Yes, using 4.06. smd_slimbox is 0.22, smd_lib is 0.2.

I’ll install 0.31 of smd_gallery and let you know if the error disappears.

Offline

#8 2008-03-15 11:51:32

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: smd_gallery: super-flexible gallery generator

Installed 0.31 – same error message. Note that I only installed and activated the plugin – nothing else.

Offline

#9 2008-03-15 12:19:40

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,413
Website GitHub

Re: smd_gallery: super-flexible gallery generator

jstubbs wrote:

Fatal error: Cannot redeclare smd_addqsvar()

Well that’s most odd; it claims it’s clashing with an identically-named function in smd_lib. They do indeed contain the same functions (I duplicated them because I wanted smd_gallery to work without smd_lib for the time being until I decide what to do with it) but I’ve enclosed the version I use in smd_gallery with a check to see if it’s already declared. It should silently ignore it and use the one from smd_lib in that case.

A puzzler for sure. Since you have smd_lib installed and activated you can temporarily get round it by removing the two functions at the end of smd_gallery (from if (!function_exists("smd_removeQSVar")) { onwards). But I’d really like to know why your setup is ignoring the “if !function_exists”. I wonder if it’s a strange PHP version issue.

EDIT: or I wonder if it’s the order the plugins are loaded? Perhaps if smd_gallery is loaded before smd_lib, the check will go “that’s fine, smd_addqsvar doesn’t exist, I’ll go ahead and declare it”. Then a few seconds later smd_lib itself comes along which doesn’t have the check in it and tries to redeclare it. Hmmm. Can any devs or more knowledgeable beings confirm this behaviour and offer any work-arounds (aside from the obvious one of adding the function_exists check around both sets of declarations which I will do anyway)? Do plugins get loaded in ‘id’ order?

smd_slimbox is 0.22, smd_lib is 0.2.

Though it probably won’t make any difference to this specific problem, why are you running such old versions? Does the new one do something you don’t like? If so, let me know and I’ll try to address it for you. Current versions are 0.212 for slimbox and 0.31 for smd_lib.

Last edited by Bloke (2008-03-15 12:28:59)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#10 2008-03-15 12:28:06

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: smd_gallery: super-flexible gallery generator

Stef, on this site the idea is to replace smd_slimbox with the new smd_gallery – so its not necessary for the two to live together. I am hosted on Joyent if that helps – its probably something with the PHP.ini file.

Older versions of smd_slimbox – I can’t keep up with your upgrades :-) I thought I had the latest version!

I am currently testing _gallery with the Fancy Zoom script. Is it best to use the example #1 in the plugin help for a lightbox/fancy zoom gallery?

<a rel="lightbox-{category}" href="{url}" alt="{alt}"
     title="A picture of {title}" height="{height}" width="{width}">
 <txp:thumbnail id="{id}" />
</a>

I mean – is there anything in particular that SHOULD be in the form?

Offline

#11 2008-03-15 12:44:23

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,413
Website GitHub

Re: smd_gallery: super-flexible gallery generator

jstubbs wrote:

Stef, on this site the idea is to replace smd_slimbox with the new smd_gallery – so its not necessary for the two to live together.

OK, but if you have any other smd_ plugins that require smd_lib then it may be a problem – see my edit above for another random thought I had on the issue. Perhaps deleting smd_gallery and re-installing it will give it a higher ID in the database and thus they’ll load in the correct order (stab in the dark here). Or maybe it’s the order the calls to the smd_ plugins are on the page? Maybe if slimbox occurs first the problem goes away?

I am currently testing _gallery with the Fancy Zoom script. Is it best to use the example #1 in the plugin help for a lightbox/fancy zoom gallery?

According to the FancyZoom docs that should be enough. You don’t appear to need to ‘tag’ the images with any special class in order for the script to work (which is very odd — what if there are linked images on the page you don’t want FancyZoom to touch? Perhaps I missed something in the docs). So that example#1 code should work fine. It may even be overkill, e.g. you might not even need the rel part.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#12 2008-03-15 13:06:56

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: smd_gallery: super-flexible gallery generator

Stef, on this site there are no other smd_ plugins, only the gallery plugin. I turned the smd_lib and smd_slimbox off, and all works fine.

I have now got the gallery working, with this form (using Fancy Zoom):

<txp:if_different>
<h3>{category_title}</h3>
</txp:if_different>
<a href="{url}" title="{title}" <img src="{thumburl}" alt="{alt}" /></a>

Here is the URL for a quick peek. Looks good to me so far – thanks for the excellent plugin!

Last edited by jstubbs (2008-03-15 13:08:05)

Offline

Board footer

Powered by FluxBB