Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#529 2009-08-01 06:08:05
Re: smd_gallery: super-flexible gallery generator
I’m using hak_article_image for the image display placeholder with the urloverride set to true. All works well when I specify that smd_gallery output the thumbs with the following form: <a href="<txp:permlink />?p={id}"><img src="{thumburl}" alt="" /></a>
The ?p={id}
does the trick in the url for image display. However, it gets interesting when I try to employ smd_gallery’s paging powers…
I needed to do something like this to construct the correct link for my thumbnails:
<a href="<txp:permlink />?p={id}&{galleryid}={navthis}"><img src="{thumburl}" alt="" /></a>
{navthis}
doesn’t work because it outputs an <li>
with it by default
QUESTION 1: Is there a way to output the page number alone (without any wraptags/styling)?
My solution:
I edited the plugin code to create a replacement tag {navthisnum} for the page number alone:
added: '{navthisnum}' => $thumPage,
on line 465 below '{navthis}' => $thumPage,
added: '{navthisnum}' => $thumPage,
below '{maximages}' => $allImages,
on or around line 517
<a href="<txp:permlink />?p={id}&{galleryid}={navthisnum}"><img src="{thumburl}" alt="" /></a>
QUESTION 2: Is is possible to turn off paging IF there is only one page? I tried using the double smd_if test (see post #528 above), but it still outputs the page numbers. Please let me know if I need to look harder for a solution or if this is something I probably won’t be able to work around on my own. thanks in advance!
Last edited by photonomad (2009-08-02 20:19:44)
Offline
#530 2009-08-03 22:52:22
Re: smd_gallery: super-flexible gallery generator
Having a nightmare with this one still :(
I think its down to my incompetence rather than the plugin though.
I’m have a parent image category (no images), with lots of sub level categories (varying images). I am calling smd_gallery like this:
<txp:smd_gallery category="corporate" sublevel="all" form="trt-gallery" onchange="category_title" wraptag="div" thumblimit="1" class="trtgallery" grouptag="div" groupclass="trtholder" sort="category asc" />
and the trt-galley form is like this:
{grouptagstart}
<a rel="shadowbox[{category}]" href="{url}">{object}</a>
<br />
<em>{onchange:category_title}</em> <!-- Displays Category title under thumbnail -->
{grouptagend}
Now this is working fine – except for one thing… I want to sort the sublevel images by the alt tag.
If I use sort=“alt asc” – then I do get some strange results.
I think its something to do with using onchange:category_title and the sort=“alt asc” – Stef says not to make these 2 different, but I can’t see another way of doing this.
Any help?
Offline
#531 2009-08-04 03:12:24
Re: smd_gallery: super-flexible gallery generator
OK – I’ve sorted this for the moment by using sort=“name asc” :)
Not sure why it wasn’t working with sort=“alt asc” – but it gave me all kinds of strange results.
I have no idea how hard it would be (probably well hard) – but it would be great to have 2 sorts (or even 3) – one for the initial display (if using categories) and one for the sublevel categories… (or is that already possible?)
That said, I am well happy with this plugin as it is :)
Thanks Bloke :)
Last edited by tye (2009-08-04 03:13:40)
Offline
#532 2009-08-14 00:14:21
Re: smd_gallery: super-flexible gallery generator
Very basic help needed. It’s probably been answered a bunch of times already but I’m unable to find any info on this thread or any other. I apologize beforehand.
I’m trying to figure out how to create a simple image gallery inside an article that calls all thumbnails from a category. I would like it to display the thumbnails and the first image when the page loads. Clicking on a thumbnail replaces the old image with the new image (still underneath the thumbnails on the same page). I’ve figured out the thumbnails, but they only link directly to the images, so a new page opens with just the image.
This is what I have in the article: <txp:smd_gallery category=“current” sublevel=“all” form=“gallery” thumb=“0:1” wraptag=“ul” break=“li” />
This what I have in the gallery form: <a rel=”{category}” href=”{url}” title=”{caption}”><txp:thumbnail id=”{id}” /></a>
So, I’m just missing how to display images when the page loads and when a thumbnail is pressed.
Any help would be greatly appreciated. I just can’t wrap my head around it.
Offline
#533 2009-08-14 08:08:31
Re: smd_gallery: super-flexible gallery generator
utilitygrade wrote:
I would like it to display the thumbnails and the first image when the page loads. Clicking on a thumbnail replaces the old image with the new image
Does Example #2 #3 in the plugin documentation get you anywhere? It’s the closest example I can think of right now to what you want. Just replace the mouseover
with onclick
and remove the mouseout
stuff. If you’re still stuck after that, ask again and post your form/container code.
Last edited by Bloke (2009-08-14 15:19:30)
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
#534 2009-08-14 16:24:53
Re: smd_gallery: super-flexible gallery generator
Thanks for your help Bloke. That did it. I just needed a nudge to get that “Aha” moment. Great plug-in. I’ve finally found the gallery system with all the control I’ve been looking for. Sorry to bother you with such a beginner question.
All the best,
Larry
Offline
#535 2009-08-15 00:25:47
- woof
- Member
- Registered: 2004-08-01
- Posts: 128
Re: smd_gallery: super-flexible gallery generator
I would like to grab images for a slideshow from an image category but exclude any images where the orientation is portrait (or vice versa), is there any way to achieve this using smd_gallery?
Offline
#536 2009-08-15 00:45:51
Re: smd_gallery: super-flexible gallery generator
You can try the following:
fetch all images from the category, and then “filter out” (= don’t output anything) any images where width < height (or viceversa) using smd_if.
One downside of this workaround comes if you need to do something like counting the total amount of images (which will included even those filtered out).
Offline
#537 2009-08-15 02:31:34
- woof
- Member
- Registered: 2004-08-01
- Posts: 128
Re: smd_gallery: super-flexible gallery generator
Thanks Julián
In this case I won’t need the image count so your suggested workaround would be perfect.
I’ve tried to implement it but I’m having trouble and I think its because I’m not sure how to correctly provide smd_if
with the width and height values.
here’s where I’m at:
tag:
<ul id="slideshow"><txp:smd_gallery category="gerbils" form="slideshow_list" /></ul>
form:
<txp:smd_if field="{width}" operator="gt" value="{height}">
<li>
<img src="{url}" alt="{alt}" width="{width}" height="{height}" />
</li>
</smd_if>
but I get no output. Any ideas? Thanks
Offline
#538 2009-08-15 03:29:50
Re: smd_gallery: super-flexible gallery generator
Maybe this:
<txp:smd_if field="{width}" operator="gt:NUM" value="{height}">
<li>
<img src="{url}" alt="{alt}" width="{width}" height="{height}" />
</li>
</smd_if>
Or this:
<txp:variable name="width" value="{width}" />
<txp:smd_if field="txpvar:width" operator="gt:NUM" value="{height}">
<li>
<img src="{url}" alt="{alt}" width="{width}" height="{height}" />
</li>
</smd_if>
Offline
#539 2009-08-15 03:32:42
Re: smd_gallery: super-flexible gallery generator
woof wrote:
I would like to grab images for a slideshow from an image category but exclude any images where the orientation is portrait (or vice versa), is there any way to achieve this using smd_gallery?
Take a look at txp:soo_image_select. It has an image_aspect attribute that looks as though it’s capable of excluding portrait orientated images out of the box; also other slideshow generating tasks. Haven’t used it yet but am about to see how it goes.
Last edited by joebaich (2009-08-15 03:33:55)
Offline
#540 2009-08-15 10:01:57
- woof
- Member
- Registered: 2004-08-01
- Posts: 128
Re: smd_gallery: super-flexible gallery generator
maniqui
Thanks for all your help. Eventually I discovered that I had stupidly made a typo with the closing tag above (it should read </txp:smd_if>
). With this corrected all three form examples above work perfectly. Sorry for any confusion and thanks again.
joebaich
Cheers, that sounds good, I’ll check it out
Offline