Textpattern CMS support forum

You are not logged in. Register | Login | Help

#641 2010-02-01 11:05:53

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,315
Website

Re: smd_gallery: super-flexible gallery generator

P wrote:

gallery does not work with IE7 and prior versions.

I’m not very good at figuring out why stuff doesn’t work across browsers. My usual hit-list is to check the DOCTYPE and/or markup isn’t triggering quirks mode, then check that the javascript is doing what it is supposed to be doing (i.e. no odd errors are generated). If that fails you could seek help on the slideshow2 forum, if there is one. Last resort is to put a big banner on your page telling people to use a proper browser ;-)


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

#642 2010-02-01 17:04:09

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 558
Website

Re: smd_gallery: super-flexible gallery generator

◦Are you generating the gallery from an individual article context?
◦When you click on the next page, does the URL stay the same apart from the ‘X’ in the ?smd_glry_nnnn=X part?

yep

◦What does the plugin set ?smd_glry_* to?

?smd_glry_f47e=3

Does that value prevail in the URL when you navigate between pages or does it change?

yep it’s prevail

◦150 images per page! Wow… does it make any difference if you reduce this, just to test it out?

I changed it to 50 and still not working, I got 568 images in that category.

Here is the debug info:

++ WHERE CLAUSE ++
(1=1 AND  (txp_image.category IN ('my_image_category_name'))  AND txp_category.type = "image") ORDER BY txp_image.category asc
			SELECT DISTINCT txp_image.name,txp_image.id,txp_image.alt,txp_image.caption,txp_image.category,txp_image.author,txp_image.date,txp_image.ext,txp_image.w,txp_image.h,txp_image.thumb_w,txp_image.thumb_h,txp_image.thumbnail, txp_category.title AS category_title
			FROM txp_image LEFT JOIN txp_category
			ON txp_image.category = txp_category.name
			WHERE (1=1 AND  (txp_image.category IN ('my_image_category_name'))  AND txp_category.type = "image") ORDER BY txp_image.category asc
			LIMIT 0, 99999
++ REPLACEMENTS : IMAGE 1 ++
array (
  '{navfirst}' => '<div class="empty">First</div>',
  '{navprev}' => '<div class="empty">&laquo;</div>',
  '{navearlier}' => '',
  '{navthis}' => '<div class="current empty">1</div>',
  '{navthisurl}' => '<div class="current"><a href="/photos/my_image_category_name/?smd_glry_f47e=1">1</a></div>',
  '{navlater}' => '<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=2">2</a></div>
<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=3">3</a></div>
<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=4">4</a></div>
<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=5">5</a></div>
<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=6">6</a></div>
<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=7">7</a></div>
<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=8">8</a></div>
<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=9">9</a></div>
<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=10">10</a></div>
<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=11">11</a></div>
<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=12">12</a>
</div>',
  '{navnext}' => '<div><a href="/photos/my_image_category_name/?smd_glry_f47e=2">&raquo;</a></div>',
  '{navlast}' => '<div><a href="/photos/my_image_category_name/?smd_glry_f47e=12">Last</a></div>',
  '{navthispageurl}' => '/photos/my_image_category_name/?smd_glry_f47e=1',
  '{navnextpageurl}' => '/photos/my_image_category_name/?smd_glry_f47e=2',
  '{navprevpageurl}' => '',
  '{navfirstpageurl}' => '/photos/my_image_category_name/?smd_glry_f47e=1',
  '{navlastpageurl}' => '/photos/my_image_category_name/?smd_glry_f47e=12',
  '{totalimages}' => 50,
  '{totalpages}' => 12,
  '{maximages}' => 568,
  '{id}' => '349',
  '{name}' => '290.jpg',
  '{ext}' => '.jpg',
  '{category}' => 'my_image_category_name',
  '{category_title}' => 'my_image_category_name',
  '{author}' => 'admin',
  '{hasthumb}' => '1',
  '{url}' => 'http://www.my-domain-name.nl/images/349.jpg',
  '{thumburl}' => 'http://www.my-domain-name.nl/images/349t.jpg',
  '{imagepath}' => 'http://www.my-domain-name.nl/images/',
  '{imagedef}' => '349.jpg',
  '{thumbdef}' => '349t.jpg',
  '{alt}' => '',
  '{title}' => '',
  '{caption}' => '',
  '{thumbwidth}' => '80',
  '{thumbheight}' => '80',
  '{thumbwunits}' => '',
  '{thumbhunits}' => '',
  '{width}' => '720',
  '{height}' => '480',
  '{wunits}' => '',
  '{hunits}' => '',
  '{date}' => '13.01.10',
  '{galleryid}' => 'smd_glry_f47e',
  '{index}' => 0,
  '{counter}' => 1,
  '{thumbindex}' => 0,
  '{thumbcounter}' => 1,
  '{onchange:category}' => 'my_image_category_name',
  '{grouptagend}' => '',
  '{grouptagstart}' => '',
  '{object}' => '<img src="http://www.my-domain-name.nl/images/349t.jpg" width="80" height="80" />',
)
++ PAGING REPLACEMENTS ++
array (
  '{navfirst}' => '<div class="empty">First</div>',
  '{navprev}' => '<div class="empty">&laquo;</div>',
  '{navearlier}' => '',
  '{navthis}' => '<div class="current empty">1</div>',
  '{navthisurl}' => '<div class="current"><a href="/photos/my_image_category_name/?smd_glry_f47e=1">1</a></div>',
  '{navlater}' => '<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=2">2</a></div>
<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=3">3</a></div>
<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=4">4</a></div>
<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=5">5</a></div>
<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=6">6</a></div>
<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=7">7</a></div>
<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=8">8</a></div>
<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=9">9</a></div>
<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=10">10</a></div>
<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=11">11</a></div>
<div>
<a href="/photos/my_image_category_name/?smd_glry_f47e=12">12</a>
</div>',
  '{navnext}' => '<div><a href="/photos/my_image_category_name/?smd_glry_f47e=2">&raquo;</a></div>',
  '{navlast}' => '<div><a href="/photos/my_image_category_name/?smd_glry_f47e=12">Last</a></div>',
  '{navthispageurl}' => '/photos/my_image_category_name/?smd_glry_f47e=1',
  '{navnextpageurl}' => '/photos/my_image_category_name/?smd_glry_f47e=2',
  '{navprevpageurl}' => '',
  '{navfirstpageurl}' => '/photos/my_image_category_name/?smd_glry_f47e=1',
  '{navlastpageurl}' => '/photos/my_image_category_name/?smd_glry_f47e=12',
  '{totalimages}' => 50,
  '{totalpages}' => 12,
  '{maximages}' => 568,
)

Offline

#643 2010-02-01 17:16:49

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,315
Website

Re: smd_gallery: super-flexible gallery generator

THE BLUE DRAGON

Weird. If your article is an individual article, I can’t figure out why the paging URLs look like this:

/photos/my_image_category_name/?smd_glry_f47e=2

That implies that your section is ‘photos’ and your article is called ‘my_image_category_name’, right? If so, I don’t know where the trailing slash before the question mark is coming from. Perhaps that’s throwing things into disarray? Can you somehow generate the URL without the slash? (although I must admit it makes no difference on my test site)

Another wild card: are you using gbp_permanent_links? If so, is there a rule getting in the way and not passing the ?smd_glry_f47e variable back to the page?


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

#644 2010-02-01 17:56:57

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 558
Website

Re: smd_gallery: super-flexible gallery generator

Yea that was the problem that my article title was same as the category name
so I changed the title + the URL-only title to something else, and now it works fine :)

Thank you! =)

And is there a way to show the paging only when it needs to
so if it’s less then 150 images (as my limit#) it will not show any of the paging form?
maybe putting the pageform="" pagepos="" navwraptag="" navclass="" navbreak="" into some “if” tag ?

Offline

#645 2010-02-01 21:31:32

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,315
Website

Re: smd_gallery: super-flexible gallery generator

THE BLUE DRAGON wrote:

And is there a way to show the paging only when it needs to

Untested but perhaps something like this inside your pageform might work:

<txp:smd_if field="{maximages}" operator="gt" value="150">
{navfirst}{navprev}{navearlier}{navthis}{navlater}{navnext}{navlast} <div>Displaying {totalimages} of {maximages} photos.</div>
</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

#646 2010-02-01 21:50:20

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 558
Website

Re: smd_gallery: super-flexible gallery generator

why not, why not! yep working good :)
thank you ;)

Offline

#647 2010-03-01 16:28:15

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,315
Website

Re: smd_gallery: super-flexible gallery generator

Just published an enhancement to the plugin: v0.55 introduces the ability to filter by image name. It’s a bit more involved than the id and category attributes because you can do some wild things with it. For example:

  • name="tiger.jpg, zebra.jpg, penguin.jpg" would show those 3 images
  • name="monkey:regex" would find any images with the word ‘monkey’ in them
  • name="tiger.jpg, ^monkey:regex" would find any images that started with the word ‘monkey’, and also show tiger.jpg
  • name="^monkey[[:digit:]][[:digit:]].jpg$|regex" would find any jpg images that started with the word ‘monkey’ and were followed by two digits. Note that in this example paramdelim="|" would need to be specified as well because we’re using the colon in the regular expression

You can do all the usual things like get lists of images from custom/article fields by specfying a ? at the start. You can also negate lists of image names using the ! operator, however, due to the way it works this can be hit and miss if used directly inside the attribute (more miss than hit).

To circumvent this, it’s often best to define your regex somewhere else — for example a <txp:variable /> or in an article field and then negate that. For example:

<txp:variable name="excludes">^(penguin|bird)</txp:variable>
<txp:smd_gallery name="!excludes:regex">
   // form contents here
</txp:smd_gallery>

would display a gallery of all images that did not start with ‘penguin’ or ‘bird’.

I’m sure there’s a lot more you can do with this, but you need to keep your wits about you because it can pull out some seemingly unexpected results if combined with the id and category attributes, especially if you have images that aren’t categorised.

But for those people who have a good naming convention, have uploaded a tonne of images and can’t be bothered to categorise them, this new attribute might get you out of a hole. Have a play with it and let me know how you get on.


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

#648 2010-03-03 08:34:53

eivl
Member
Registered: 2009-04-09
Posts: 20

Re: smd_gallery: super-flexible gallery generator

Hello Stef, i have a question and i am hoping you can answer before i have finnished reading through all 65 pages!

this is my article:

<txp:smd_gallery category=“Barn, Mann, Dame” sort=“name” form=“gallery” onchange=“category_title” onchangewraptag=“h3”>
</txp:smd_gallery>

This is my form:

{onchange:category_title}<a href=”{url}” title=”{title}” rel=“shadowbox[gallery{alt}]”>
<img class=“img” src=”<txp:site_url/>images/{thumbdef}” alt=”{alt}” />
</a>

—————

i have the following setup on my images, i have the same name in the ALT field on tree and tree pictures. but i only want to show the first image skip the second and third, and then show the first and skip the two next and so on and so on.

every time i upload new images it will always be three and three.

i want to click a image (the first) and shadowbox shows with a slideshow off the three images.

hope i have explained it enough.

eivl

Offline

#649 2010-03-04 10:00:11

jpdupont
Member
From: Virton (BE)
Registered: 2004-10-01
Posts: 719
Website

Re: smd_gallery: super-flexible gallery generator

Stef,

any chance to get the “directory” filter working ?

Actually, on my host, I get this working :

directory="/home/www/3370847b68efbfb60754cc52abf91b35/users/multimedia/web/internat/interface/"

but this give no output :

directory="/images/interface/"

or

directory ="http://www.mysite.be/images/interface/" 

On an other hand, if txp debug is on, I get many thumnails errors.

Offline

#650 2010-03-11 01:10:31

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,315
Website

Re: smd_gallery: super-flexible gallery generator

jpdupont wrote:

any chance to get the “directory” filter working ?

Short answer is I don’t know, unfortunately. It worked in my rudimentary testing but my host has no support for opening URLs as files, so I couldn’t test that bit. I suppose I could try it in XAMPP and see if I can get it working. Will see what I can do.

In the meantime, here’s v0.6 to play with. The major change is that we can hopefully (finally) say goodbye to the problems with trying to pull out image IDs of uncategorised images. I completely ditched the SQL join and settled on a lazier, more direct (and more robust) approach. Shouldn’t break anything (apart from the fact that your image lists will actually be what you expect now!)

Also added the ability to specify ranges of numbers in countform, e.g. countform="3-7:my_form" would call my_form when the 3rd thru 7th (inclusive) images were encountered.

Finally, a new attribute grouplimit was added that allows you to limit the number of images shown in each group (e.g. in each category). Here’s how the limits differ:

  • maxlimit is a hard limit of records pulled from the database
  • limit affects the number of images displayed per page in a multi-page gallery
  • thumblimit only shows the given number of {object} tags at each onchange before rendering the remainder of the links as empty anchors
  • grouplimit only allows you to navigate/see this many images in each onchange group (see example 12 in the help)

As always, let me know if this version gives your galleries the horn or not.


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