Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2008-02-25 14:39:49

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

Re: smd_gallery: calling all testing masochists :-)

OK, this is starting to work really well for me. Regarding the full-size placeholder not loading I made a silly mistake: the image’s path was incorrect.

I now have an article form that automatically appends a (caption-less) gallery based on the value of a custom field.
From the article form I call <txp:output_form form="gallery" /> immediately after <txp:body />

Contents of form gallery:

<div><img id="fullsize" src="/txp406/images/10.jpg" width="450" height="299" /></div>
<div><txp:smd_gallery category="?custom1" form="gallery-thumbs" /></div>

Contents of form gallery-thumbs:

<a href="{url}" title="{title}" onmouseover="document.getElementById('fullsize').src = this.href; return false;">
<img src="{thumburl}" alt="{alt}" />
</a>

I tried to combine gallery and gallery-thumbs but couldn’t get that to work.

OK, scrap that, I got it working now with a single form:

<div><img id="fullsize" src="/txp406/images/10.jpg" width="450" height="299" /></div>
<div><txp:smd_gallery category="?custom1">
<a href="{url}" title="{title}" onmouseover="document.getElementById('fullsize').src = this.href; return false;">
<img src="{thumburl}" alt="{alt}" />
</a>
</txp:smd_gallery></div>

If you now could add the option to display a random image from the gallery as the placeholder, it would be perfect! :-)

Thanks again!

Cheers Martin

Last edited by masa (2008-02-25 14:58:43)

Offline

#26 2008-02-25 15:06:29

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,538
Website GitHub

Re: smd_gallery: calling all testing masochists :-)

Hey, glad it’s working for you.

masa wrote:

If you now could add the option to display a random image from the gallery as the placeholder, it would be perfect! :-)

It’s on the ToDo list. I’ll experiment with it when I get a chance. I have a TXP site that needs urgent attention just now (pertty much a complete rewrite) so that’ll be my focus for the next week or so. After that I’ll get back into my sand pit and play with this and the watermarking plugin.

Oh, and thanks for the comment about the docs. Brilliant! I know it’s something I have to work on and I’m hoping to enlist the help of gluteus for that. [ btw, you’ll see your quote crop up again in the near future; keep an eye on the forum ;-) ]


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

#27 2008-02-28 17:32:08

jelle
Member
Registered: 2006-06-07
Posts: 165

Re: smd_gallery: calling all testing masochists :-)

Hi guys…

it’s me again….I bumped in to another interesting “lightbox-look-a-like” called Highslide. -> http://vikjavev.no/highslide/

Offline

#28 2008-02-28 18:42:21

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

Re: smd_gallery: calling all testing masochists :-)

I like this one even more

Offline

#29 2008-02-28 19:59:12

jelle
Member
Registered: 2006-06-07
Posts: 165

Re: smd_gallery: calling all testing masochists :-)

jstubbs wrote:

I like this one even more

woah….that one is sexy!

Offline

#30 2008-02-28 22:23:42

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,178
Website

Re: smd_gallery: calling all testing masochists :-)

Got a chance to play with it and it’s great! Not being familiar with your previous plugin or wet_for_each it took a bit of guessing to grab the article images. In the end I did it like this – is that right?

<txp:smd_gallery id="?article_image" limit="3">

It seemed to work just fine whether called from an article form or placed in the if_individual_article part of the page form. I have the thumbs and full-size images in different divs on the same page and the divs are numbered with an individual id (took the image id for this) so I used the tag a few times over (js variable definition in head, thumbs, images) but it worked fine without causing a huge number of queries.


TXP Builders – finely-crafted code, design and txp

Offline

#31 2008-02-28 23:08:32

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,538
Website GitHub

Re: smd_gallery: calling all testing masochists :-)

jakob wrote:

Got a chance to play with it and it’s great! Not being familiar with your previous plugin or wet_for_each it took a bit of guessing to grab the article images.

Hey cool, glad it’s useful. You did it right. fwiw, if you need a cheat sheet of things that are available to you, temporarily give the plugin debug="4" as an option and it’ll spit out (towards the bottom of all the other gumph) a list of variables that the plugin can “see”. Any name to the left of a “=>” is fair game for putting a ‘?’ in front of (or an ‘!’ of course) in the plugin attributes; you can even make combos using them.

I used the tag a few times over (js variable definition in head, thumbs, images) but it worked fine without causing a huge number of queries.

Yeah, that’s something I’d love to fix. Ideally I’d like to have it so you could “set up” the info and then “use” those thumbs many times further on the page. Unfortunately it breaks down on article list pages and I haven’t figured out a way of overcoming it yet. Perhaps some conditional tags might work? But if you (or anyone) have any ideas then feel free to share :-)

Thanks for testing it for me. Feedback welcome any time.

Last edited by Bloke (2008-02-28 23:10:00)


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

#32 2008-02-29 08:09:54

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,178
Website

Re: smd_gallery: calling all testing masochists :-)

Yes, I did just that and looked through the copious debug infos. What I wasn’t sure about was the attribute to use as most(all) examples used category but some trial and error. I also put txp into debug mode and the plug-in then threw out some bugs but it worked all the same. They disappear when put back to live.

I didn’t use any forms just yet but what type should they be: misc?

One thing I had thought of was a {counter} variable which would be just the loop count (guessing: {counter}=$idx). I was revamping a site from 2004/2005 and the js originally used sequential numbers to number the divs and behaviours. I then twigged I could use the image IDs to have a unique ID.

EDIT:
One problem has arisen: where no article-images are specified it takes the first three from the database.

Last edited by jakob (2008-02-29 08:59:36)


TXP Builders – finely-crafted code, design and txp

Offline

#33 2008-02-29 09:07:08

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,538
Website GitHub

Re: smd_gallery: calling all testing masochists :-)

jakob wrote:

Yes, I did just that and looked through the copious debug infos. What I wasn’t sure about was the attribute to use as most(all) examples used category but some trial and error.

Thanks for the info jakob. I’ll add some more varied examples when I get chance. As you probably found out, id is the other common one for grabbbing stuff from the database.

I also put txp into debug mode and the plug-in then threw out some bugs but it worked all the same.

Oo-er. Not good. Can you remember what they were? I didn’t spot any on my site that’s running in debug mode, but I’m using an old version of PHP. I remember some people had errors under PHP5 from my plugins in the past. I’d best fix those.

I didn’t use any forms just yet but what type should they be: misc?

I don’t think it makes much difference (I never found a use for any form “types” aside from where they appear in the list!). I use misc most of the time.

One thing I had thought of was a {counter} variable which would be just the loop count (guessing: {counter}=$idx).

Y’know, I thought that was in there but maybe I forgot to add it. Well spotted. I’ll make sure it’s in there for the next version. Thanks.


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

#34 2008-03-12 03:19:19

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,538
Website GitHub

Re: smd_gallery: calling all testing masochists :-)

OK, I’ve gone ahead and officially released it. Fixed the problem jakob highlighted and added the counters he requested (thanks), and rolled all the docs/examples into the plugin.

The documentation will be ironed out over time as I find better ways of explaining stuff. If anyone has any input or cool forms/layouts/tags that demonstrate the plugin, please shout.

The directory mode is still untested but there’s not much call for it so it’ll probably stay dormant for a while yet. Anything else you find, please throw it in the official thread.

I’m really sorry masa but I’ve failed you on the random image thing so far. I tried loads of different ways to do it this evening and got most of the way there, but it just wasn’t very “clean”. Since the plugin iterates over each image one by one and cannot know in advance into which part of the form you want to put the random image, it can’t decide which image to choose. If I think of a cunning way round it I’ll be sure to include it in a future release.

Thank you to all the people who took time out of their precious schedules to test this hunk of code in its raw form and provide feedback. I hope it continues to help you out.


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

#35 2008-03-12 07:34:41

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: smd_gallery: calling all testing masochists :-)

Shall I close and archive this thread, then? :)

Offline

#36 2008-03-12 08:12:34

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,538
Website GitHub

Re: smd_gallery: calling all testing masochists :-)

Mary wrote:

Shall I close and archive this thread, then? :)

Might as well, yes please.


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

Board footer

Powered by FluxBB