Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#589 2009-11-12 08:35:34
- mlarino
- Member
- Registered: 2007-06-29
- Posts: 367
Re: smd_gallery: super-flexible gallery generator
Hi,
I am trying to create a thumbnail gallery that paginates every 21 images, but that lauches a lightbox from any of them that can display all the images in the gallery.
right now I have acomplished to show in the lightbox those 21 images, but it doesnt show the images from the rest of the pages.
Is it posible to something like that?
this is the code I am using now:
page:
<txp:smd_gallery category="comic" sublevel="all" form="gallery" pageform="gallery_nav" navbreak="div" navclass="" limit="21" sort="id desc" />
form:
<a rel="lightbox-{category}" href="{url}" title="{caption}">{object}</a>
You can see it here:
www.mlarino.com/santy/comics
Last edited by mlarino (2009-11-12 08:37:24)
Offline
#590 2009-11-12 10:25:49
- alanpmcd
- Member
- Registered: 2009-05-02
- Posts: 21
Re: smd_gallery: super-flexible gallery generator
Hi mlarino. I failed to solve the self-same problem with lightbox and ended up using a thing called FancyZoom instead, using more-or-less identical coding to what you’re using.
Here’s Fancy Zoom
Here (I have the added complexity of offering people a choice by picture category) is how my pages look
Hope this helps.
Offline
#591 2009-11-12 10:55:24
Re: smd_gallery: super-flexible gallery generator
@mlarino: Use thumblimit="21"
instead of limit="21"
can help? Work for me without pagination, though.
Offline
#592 2009-11-12 12:25:52
- mlarino
- Member
- Registered: 2007-06-29
- Posts: 367
Re: smd_gallery: super-flexible gallery generator
alanpmcd wrote:
Hi mlarino. I failed to solve the self-same problem with lightbox and ended up using a thing called FancyZoom instead, using more-or-less identical coding to what you’re using.
But in your site your FancyZoom doesnt navigate through all the images, it just opens the one of them.
What I have set up now already opens one image, and can navigate throgh all the ones that are loaded in one page, but stops with thumblimit.
Zanza wrote:
Use thumblimit=“21” instead of limit=“21” can help? Work for me without pagination, though.
Doesnt help, that doesnt paginate, and need it to paginate.
each page 21 thumbs, but that the lightbox can navigate through all the images in the gallery.
Offline
#593 2009-11-12 13:12:56
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: smd_gallery: super-flexible gallery generator
mlarino, it’s been over a year since I used this so it’s a bit of a stab in the dark, but isn’t this a use case for collate mode?
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#594 2009-11-12 15:40:36
Re: smd_gallery: super-flexible gallery generator
mlarino wrote:
each page 21 thumbs, but that the lightbox can navigate through all the images in the gallery.
Good suggestions from all but I think you’re out of luck here with conventional methods. You must use limit
or it won’t do the paging, but using limit
terminates the gallery list at that number of images. Off the top of my head you’re looking at using multiple smd_gallery tags here, or if that fails then smd_query.
Since most lightbox scripts will trundle through all images on the page if they have the same rel=
attribute, you can use this to your advantage. Set up the first smd_gallery tag to display limit="21"
and a second gallery tag with thumblimit="0" offset="21"
to grab the remaining images and simply hide them. As long as the rest of the attributes to both tags are the same and you make sure they use the same rel=
(they can probably use the same form
) then you should get the desired behaviour. Not super-efficient but it’s only 2 database calls instead of one on each page. The only thing that might not work is on the 2nd, 3rd, etc pages, the second tag might still include the 22nd, 23rd, 24th… images again because it’s not taking the page number into account. Let me know if it works.
Last edited by Bloke (2009-11-12 15:42:14)
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
#595 2009-11-12 16:03:50
- mlarino
- Member
- Registered: 2007-06-29
- Posts: 367
Re: smd_gallery: super-flexible gallery generator
Thanks Bloke!
I will give that a try!
Offline
#596 2009-11-12 16:22:47
- mlarino
- Member
- Registered: 2007-06-29
- Posts: 367
Re: smd_gallery: super-flexible gallery generator
It worked!!!
Thi is what I did just in case someone needs to do something like this.
page:
<txp:smd_gallery category="illustration" sublevel="all" form="gallery" pageform="gallery_nav" navwraptag="" navbreak="div" navclass="" limit="21" sort="id desc" />
<div style="display: none;">
<txp:smd_gallery category="illustration" sublevel="all" form="gallery" pageform="gallery_nav" navwraptag="" navbreak="div" navclass="" offset="21" sort="id desc" />
</div>
Two smd_galleries, one displaying just 21 with pagination, and a hiden one that displays all the rest of the thumbnails, using offset=“21”.
Works for the first page of the paginated gallery, but not for the rest.
In the second page I will get the next 21 thumbnails, but the same hiden gallery with an offset of “21”. So I will need to think what I can do to make the hiden gallery offset to 21 in the first page, 42 in the second page etc….
Last edited by mlarino (2009-11-12 16:24:24)
Offline
#597 2009-11-16 02:06:35
Re: smd_gallery: super-flexible gallery generator
Hi Bloke,
not sure if I’m doing something wrong, but I {thumbwidth}
and {thumbheight}
aren’t returning any value.
Any idea what could be going on? I’ve checked on the database, and colums thumb_w
and thumb_h
are populated with the correct values.
Thanks.
Offline
#598 2009-11-16 09:35:24
Re: smd_gallery: super-flexible gallery generator
maniqui wrote:
{thumbwidth}
and{thumbheight}
aren’t returning any value.
The plugin needs updating to read the values from the database. Currently it (stupidly) only works if you use thumbsize
and set the sizes manually yourself. If I get a chance I’ll try and fix this plugin up for 4.2.0. Been a bit sidetracked of late, sorry.
Last edited by Bloke (2009-11-16 09:35:48)
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
#599 2009-11-16 13:56:32
Re: smd_gallery: super-flexible gallery generator
mlarino
Hennie wrote: {navprev: <img src=“http://www.xxxx.xx/image_left.png” />}
mlarino wrote: but, why cant that be used with {navprevpageurl} ? That way the image will disapear if there is no next or previous pages…. :(
Sorry for the delay. {navprevpageurl}
and {navnextpageurl}
are the raw URLs of the next and previous pages. Why would you want to change those links to something else?
As Hennie points out you can change (‘label’) the {navprev}
and {navnext}
replacement tags, but you are right that if there is no next/prev page then your content is still drawn, just not linked with an anchor.
If you want to omit it entirely (and take the potential hit on the negative UI experience you are presenting to your visitors) you will need to take matters into your own hands and check if {navprevpageurl}
is empty. You can use smd_if, for example, in your pageform
:
<txp:smd_if field="{navprevpageurl}" operator="isused">
{navprev: <img src="http://site.com/image_prev.png" />}
</txp:smd_if>
{navthis} of {totalpages}
<txp:smd_if field="{navnextpageurl}" operator="isused">
{navnextv: <img src="http://site.com/image_next.png" />}
</txp:smd_if>
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
#600 2009-11-17 00:11:32
Re: smd_gallery: super-flexible gallery generator
Finally, the 4.2.0-only smd_gallery v0.52 hits the streets. Aside from requiring 4.2.0 or higher because of the new core thumbnail size support, this release adds some rather useful features and (sorry) more optional attributes, taking this plugin to over 50 of the buggers! Eeeeek.
Here’s a rundown:
- Thumbnail sizes now automatically read from the database. May be overridden with
thumbsize
as usual if you wish to force thumbnail dimensions so your clickable galleries appear more uniform - Image sizes can be forced with the new
imgsize
attribute - Host of new filtering options; in addition to the usual
category
andid
you can now show images by a list ofauthor
s, by fileextension
, byaspect
ratio (portrait, landscape or square) or by particular (exact, minimum or maximum)dimensions
. This opens up the possibility to dynamically alter your galleries by offering visitors the ability to filter images by custom criteria that you could build into an HTML form. With smd_if, adi_gps and/or some tags-in-tags magic your visitors can choose to only see images of a particular aspec ratio, or images over 640×480 pixels in size - Bug fixes for the things maniqui found: quote parsing and the warning when trying to do fixed sorting
Would love to see someone offering custom image searches using this plugin so if anyone builds some cool stuff with it, please let us all know about it. Share and Enjoy TM.
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