Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#316 2008-12-26 22:18:27

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: smd_gallery: super-flexible gallery generator

Hi Bloke, thanks for the detailed reply.

Re: order of images: if you are using values just from ?article_image field, couldn’t the plugin default to the order in which IDs were entered on the article-image field?

Just to clarify: I’m not asking for this feature, but asking if it would make sense. upm_article_image works that way, at least.

BTW, in my particular case, I did have to set the sort="fixed" in two smd_gallery tags because I was also using offset and limit attributes (in different each smd_gallery tags, of course), and without the sort="fixed", the output was making no sense (looked like random output, but not even that, because it always output the same).

Thanks again.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#317 2008-12-26 22:22:52

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,485
Website GitHub

Re: smd_gallery: super-flexible gallery generator

maniqui wrote:

if you are using values just from ?article_image field, couldn’t the plugin default to the order in which IDs were entered on the article-image field?

A compelling proposition; that would make sense, yes. Except you’re not limited to IDs in the article_image field. You may use categories if you wish so I’d have to test that you were using solely IDs and not categories. Or perhaps if you use article_image it does indeed — just for that field — assume a fixed order regardless. But then I’d have to find a way of allowing you to unfix that behaviour if you so desired.

Leave it with me and I’ll think about it.


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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#318 2008-12-31 07:35:07

quemultimedia
Member
From: Nairobi
Registered: 2008-12-31
Posts: 42
Website

Re: smd_gallery: super-flexible gallery generator

Greetings All,

I’m quite new to textpattern, and I’m still ‘getting a feel’ of textpattern offline. Would like some help with my ‘smd_gallery’ install. I would like to implement a ‘slide-show’ on my homepage, which picks the recent 10 images from the smd_gallery [i.e. image, title, caption e.t.c] and presents [ my inspiration comes from: http://smoothgallery.jondesign.net/ ]. I would like to implement something similar.

Second, I would like to have a section – gallery, which initially lists all sub-galleries [sub-sections], from which, when a sub-gallery is clicked, one can view slide-show of containing images, with a thumbnail list in the <div> that follows the slide-show.

Your input, help, advise will be greatly appreciated. I’m eager to implement this.


Que,
Que-Multimedia

Offline

#319 2008-12-31 11:33:18

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,485
Website GitHub

Re: smd_gallery: super-flexible gallery generator

quemultimedia wrote:

I’m quite new to textpattern, and I’m still ‘getting a feel’ of textpattern offline.

Hello and welcome. Hope you like us all here. I apologise in advance that smd_gallery is a bit of a big step for newcomers and is slightly non-TXP (in its approach) but it’s fairly logical once you get your head round it.

That said, once you’ve downloaded and installed your chosen slideshow system you’ll need to feed the gallery tag to indicate you only want 10 recent images from a particular category:

<txp:smd_gallery category="my_images" limit="10" sort="date desc" />

Then you need to tell the plugin to either pass each image to a nominated form, or do what I’m going to do here and use smd_gallery as a container so each image is processed directly inside the tag:

<txp:smd_gallery category="my_images" limit="10" sort="date desc" wraptag="div" class="myGallery">
<div class="imageElement">
  <h3>{alt}</h3>
  <p>{title}</p>
  <a href="some-section/some-page?pic={url}" title="open image" class="open"></a>
  <img src="{url}" class="full" />
  <img src="{thumburl}" class="thumbnail" />
</div>
</txp:smd_gallery>

All that does is take the format given on the “getting started” page and replaces the relevant bits (the things inside {} markers) with real info from each image. The 3rd line that links to some-page to show a full-size image you would have to design yourself. I chose here to pass a pic paramater with the URL of the image so on that page you could read that variable and fashion some HTML to show the image centre-stage. You can do it however you like; that’s just an example.

Second, I would like to have a section – gallery, which initially lists all sub-galleries [sub-sections]

TXP doesn’t have sub-sections as such, but you can use image categories (or sub-categories) and smd_gallery to achieve the same thing. If you set up one article per gallery and, say, in the article_image field you give it the name of the image category you want to use in that gallery then any time you view that particular article you can use smd_gallery to read the image category and display the corresponding gallery (use category="?article_image")

Furthermore, if you do it that way, to get a “gallery of galleries” you simply need to use the <txp:article /> tag on a section list page (i.e. in your gallery page tempate inside <txp:if_article_list>...</txp:if_article_list> tags) and it will automatically show you all articles (thus galleries) in the section. If you vary your smd_gallery tag in the article list case (perhaps use a different form in the <txp:article /> tag) you can get it to show you one image from the gallery as a thumbnail that — when clicked — will take you to the individual article to see the full gallery.

It’s a little more involved than above, so experiment away with it. If you get stuck, just say.

P.S. on the forum, if you want to show code, use bc. your-code-here. I spotted you trying to use <code> on another thread but this forum uses textile.

Last edited by Bloke (2008-12-31 11:34:11)


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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#320 2008-12-31 15:55:32

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,485
Website GitHub

Re: smd_gallery: super-flexible gallery generator

For anyone who missed the post on the slimbox thread, or who only keeps an imaging eye on this thread, Christophe Beyls has just unveiled Slimbox 2. It’s the same animal as before but based on jQuery instead of mootools. For those of you who love the slimbox approach but feel mucky having two js libraries lurking around, this is a great excuse to try it out with smd_gallery!

Thanks again to Christophe for his continuing top notch work.

Last edited by Bloke (2008-12-31 15:56:05)


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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#321 2009-01-06 06:43:58

quemultimedia
Member
From: Nairobi
Registered: 2008-12-31
Posts: 42
Website

Re: smd_gallery: super-flexible gallery generator

Thanks Bloke,

Indeed, I’m loving the response I’m getting from the TXP community, so far, I’ve made progress by leaps and bounds, and, with your advise above, hoping to implement a super slide-show using both smd_gallery and smoothgallery.

Will post some feedback on what I come across, as I make progress.


Que,
Que-Multimedia

Offline

#322 2009-01-06 09:54:49

quemultimedia
Member
From: Nairobi
Registered: 2008-12-31
Posts: 42
Website

Re: smd_gallery: super-flexible gallery generator

Bloke, Guys,

The gallery’s now working…. however, I have some small question. How can I display images from different galleries [i.e. a root gallery, and it’s sub-galleries], with minimal code? or do I just have to call all galleries individually?


Que,
Que-Multimedia

Offline

#323 2009-01-06 10:08:29

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,485
Website GitHub

Re: smd_gallery: super-flexible gallery generator

quemultimedia wrote:

How can I display images from different galleries [i.e. a root gallery, and it’s sub-galleries]

Depends what you want to achieve.

<txp:smd-gallery category="root_gallery" sublevel="all" />

Displays all images from all sub-categories of root_gallery, sorted by category. With the onchange attribute suite you can put headings above each change in category if you wish.

If you are trying to do something different, please provide an example.

Last edited by Bloke (2009-01-06 10:10:06)


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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#324 2009-01-06 22:01:24

rvturnage
New Member
Registered: 2009-01-06
Posts: 5

Re: smd_gallery: super-flexible gallery generator

Bloke, this is a very nice plugin. I’m a newbie to Textpattern and have been testing the waters since yesterday, in the hopes of figuring it out for a new prospective client. It seems to be far easier to dive into than ExpressionEngine! And it also seems to have a great online community, based on this thread! I have been able to install smb_gallery and get it working with jquery Gallerific plugin.

I’ve got a couple of questions, though, about creating a “gallery homepage”, featuring a single thumbnail from each image category with a link to view the full gallery.

First, I’ve got a parent image category named “Gallery”, with child categories for each individual gallery I’ll want to show (2008_gallery, 2009_gallery, etc.). I’m using this in my page code:

<txp:smd_gallery category="gallery" onchange="category" onchangewraptag="h2" sublevel="1" sort="fixed" thumb="1" thumblimit="1" form="gallery_overview" />

and this in my form: {onchange:category} {grouptagstart} <a href="#"><img src="{url}" alt="{alt}" /></a> <div>{title}</div> {grouptagend}

For some reason, the “thumblimit” isn’t limiting the number of thumbs that appear. It’s showing every thumbnail in each of the two categories (2008_gallery & 2009_gallery). Any ideas?

Second, is there some way to have the category attribute pulled from the URL so galleries could be loaded dynamically based on the URL?

Something like mysite.com/textpattern/gallery_view/2008_gallery/ would then load the category named “2008_gallery” into the category attribute used on the gallery_view page. This would enable me to code one gallery_view page and eliminate the need to create new gallery pages when a client wants to add a new gallery. Simply uploading the image to a new image category and then entering the gallery_view URL followed by the category name would suffice. I tried using the category=”?” attribute, but couldn’t figure out how to make it work properly…

Thanks in advance! and thanks for the great plugin!
rvt

Offline

#325 2009-01-07 10:13:21

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,485
Website GitHub

Re: smd_gallery: super-flexible gallery generator

rvturnage wrote:

{onchange:category} {grouptagstart} <a href="#"><img src="{url}" alt="{alt}" /></a> <div>{title}</div> {grouptagend}

Hi, this is one of the unfortunate side-effects of not having image encapsulation in TXP. I answered something similar a few weeks ago and that may help you work out a solution in the meantime, though it requires another plugin.

The bottom line is that every image is passed through the form and only the {object} tag understands thumblimit. I’d love to make the form/thumblimit and {object} a bit more intelligent but it either takes a tonne of extra code or a change to the way images are handled in TXP.

Having said that, I may try and revamp it a bit, because having to rely on the {object} tag as a fixed output is a pain. Perhaps an objectform might be possible, I’ll look into it and see what I can come up with.

Second, is there some way to have the category attribute pulled from the URL so galleries could be loaded dynamically based on the URL?

Today the answer is no, sorry. Tomorrow (or in a few days time at least) the answer will be yes because v0.5 unlocks this feature since it uses smd_lib which has this ability built in. So under v0.5 you’ll be able to do:

<txp:smd_gallery category="?title" />

In your case you’d need to do something a little differently because you intend not to actually create any corresponding article. In that case you have two avenues open to you:

  1. fashion your URLs like this: site.com/gallery_view/?gall=2008-gallery and use <txp:smd_gallery category="?gall" /> to read in the URL variable (perhaps gbp_permanent_links can help hide the messy URLs?)
  2. use an error_404 page template that does this somewhere inside it:
<txp:if_section name="gallery_view">
  <txp:smd_gallery category="?REQUEST_URI" form="gallery_overview" />
</txp:if_section>

(untested – might not work like that)

The idea of the last approach is that any broken link in that section will actually render a gallery. You might also want to surround the gallery tag with some conditional (e.g. the chh_if_data plugin or some clever use of the URL parts to extract the ‘title’ and put it in a <txp:variable /> that you can check), thus you can take action and show “Sorry, no gallery” for the times where there’s actually no image category of that name.

Not quite the answers you hoped, but possible avenues for exploration. I’ll try and package up v0.5 as soon as I can and release it.


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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#326 2009-01-07 11:06:15

lozmatic
Member
From: Melbourne, Australia
Registered: 2006-08-27
Posts: 259
Website

Re: smd_gallery: super-flexible gallery generator

Hi, thumblimit="1" isn’t working for me. All images are displayed instead.

I’ve got this:

<txp:smd_gallery id='17,18' thumb="0:1" form="list.photo.apartment.form" thumblimit="1" />

and the form is the one in the example:

<a rel="lightbox-smd" href="{url}" title="{title}">{object}</a>

Any ideas?

Offline

#327 2009-01-07 11:21:12

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,485
Website GitHub

Re: smd_gallery: super-flexible gallery generator

lozmatic wrote:

thumblimit="1" isn’t working for me. All images are displayed instead.

Add onchange="" to your gallery tag; by default it’s set to category. Since you’re using id instead of category, the plugin sees the 2nd image is in a new category and dutifully thinks it needs to start counting thumbs again from 1 (it resets the counter at each onchange item so you can make headed sub-galleries with one smd_gallery tag — in this case you don’t want it to do that).


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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#328 2009-01-07 14:27:16

rvturnage
New Member
Registered: 2009-01-06
Posts: 5

Re: smd_gallery: super-flexible gallery generator

Bloke wrote:

Hi, this is one of the unfortunate side-effects of not having image encapsulation in TXP. I answered something similar a few weeks ago and that may help you work out a solution in the meantime, though it requires another plugin.

Thanks, Bloke. Sorry I missed that post. I tried reading through all 33 pages prior to posting. Guess I missed a few :) I’ll go over that previous post and see if I can get it working.

Today the answer is no, sorry. Tomorrow (or in a few days time at least) the answer will be yes because v0.5 unlocks this feature since it uses smd_lib which has this ability built in. So under v0.5 you’ll be able to do:

<txp:smd_gallery category="?title" />

Not quite the answers you hoped, but possible avenues for exploration. I’ll try and package up v0.5 as soon as I can and release it.

These both look like good avenues to explore..thanks for the help. I’ll look into that gbp_permanent_links plugin too. I look forward to trying out that upgrade when you get it! Thanks again for your help, and for the great plugin.

rvt

Offline

#329 2009-01-07 14:44:55

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,485
Website GitHub

Re: smd_gallery: super-flexible gallery generator

rvturnage wrote:

Sorry I missed that post. I tried reading through all 33 pages prior to posting.

No problem. Do what I do and set your forum profile to view 20 posts per page, then it only looks half as bad :-D

Hope you find a (hopefully temporary) solution until I can address these things in the plugin itself.


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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#330 2009-01-09 14:02:03

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: smd_gallery: super-flexible gallery generator

Hellooooo,

I’ve this:

<txp:smd_gallery id="?article_image" combo="type:captioned-image,align:right" form="inline_image" />

calling this:

<txp:variable name="type" value="{type}" />
<div class="image {type} {align}" style="width:{width}px">
  <txp:upm_image image_id="{id}">
  <img src="{url}" width="{width}" height="{height}" alt="<txp:upm_img_alt />" title="<txp:upm_img_caption />"/>
  <txp:if_variable name="type" value="captioned-image">
  <small><txp:upm_img_caption /></small>
  </txp:if_variable>
  </txp:upm_image>
</div>

It works like a charm… but I was thinking how to let the end-user have more control about alignment and show/hide caption… without using custom fields…

So, I came up with this idea (ejem… feature request): abuse the article_image field :D.
Something like this (on the article_image input field):

68, captioned, right
or
15, image, left
or even crazier:
19, captioned, left, 15, captioned, right, 28, image, center

And so on…
Of course, this will require some clever way to “configure” how (in which order) smd_gallery will pick up the values…

Bloke, the ball is in your field ;)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB