Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-06-07 12:49:33

thijs
Member
Registered: 2012-04-17
Posts: 39

making an image gallery / two questions

hi all,
i’m continuing on the quest to make my main (illustration) website based on textpattern (after using wordpress), i’m really liking the system and it’s simplicity/possibilities, the more i learn. I’ve also noticed it loads much much quicker than the wordpress-based one.

I am trying to build an image gallery that will show all images on the main section page, and only images with a certain category with an extra string appended to the URL.

So for example: http://domain.com/portfolio/?c=illustration will only show images categorized as illustration
http://domain.com/portfolio/?c=portrait will show portraits
Yet the URL
http://domain.com/portfolio/ would show all images available.

I’ve noticed that when I add categories to an image, they disappear from the generic gallery. Is there a way to make the image tag behave differently? Another way to solve it?

You can take a look here: http://dev.thijsvissia.nl/portfolio/?c=illustration
(design is still preliminary…:)

Another question: is there a way to include the image categories in the main menu on the left, as subcategories?

Thanks for any help.

Last edited by thijs (2012-06-07 12:50:41)

Offline

#2 2012-06-07 15:38:40

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: making an image gallery / two questions

Hi thijs

Can you post the code for the page/form you are using to display the generic (catch-all) image gallery on your portfolio section, that might help us track down the issue? Cheers.

Regarding the image categories for the sidebar, you can use the <txp:category_list /> tag for that I think…

<txp:category_list type="image" sort="title asc" wraptag="ul" break="li" />

See here for a further explanation of the tag if needed.

Offline

#3 2012-06-07 16:10:21

thijs
Member
Registered: 2012-04-17
Posts: 39

Re: making an image gallery / two questions

Ok thank you, I’ll take a look at that bit.

As for the gallery, (I meant to include this) I used this guide:

http://textpattern.com/faq/138/can-i-make-an-image-gallery

I made a section called portfolio, and an associated page. So the code that brings up the images is:

<div id=“content”> <txp:image_index wraptag=“div” break=”“ /> <txp:image_display /> </div>

But when I set any category on an image, it disappears from what should be the full gallery.

I am not sure if I am using categories on the images in the correct way. To clarify, I’d like to use them to distinguish between different genres of drawings, but it may have been conceived differently by the builders of textpattern.

Maybe I should just go with any of the available plugins, but I think this way I’ll learn more about textpattern, so thanks for indulging. ;)

Offline

#4 2012-06-07 16:37:26

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: making an image gallery / two questions

Textpattern’s core image tags should be able to provide you all you need to build an image gallery and I’d recommend those over any plugin for the simple reason that you are then not reliant on a third-party to keep the code updated with subsequent Textpattern releases.

Anyway, I have to admit I’ve never personally used the <txp:image_index /> or <txp:image_display /> tags – the newer <txp:images /> tag introduced in Textpattern v4.3 should be enough to give you the desired result. It is much more flexible than the two tags you’ve mentioned, which are directly limited to if you are viewing a category only.

Example:

<div id="content">
  <txp:images category="" sort="category asc" thumbnail="1">
    <txp:if_different>
      <h3><txp:image_info type="category_title" /></h3>
    </txp:if_different>
    <txp:thumbnail wraptag="div" />
  </txp:images>
</div>

There’s loads more you can do with the <txp:images /> tag, see here for further info.

Last edited by philwareham (2012-06-07 16:39:27)

Offline

#5 2012-06-07 19:26:29

thijs
Member
Registered: 2012-04-17
Posts: 39

Re: making an image gallery / two questions

great, thank you Phil, I’ll explore a bit further from your suggestions.

Offline

#6 2012-06-07 21:09:41

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,315

Re: making an image gallery / two questions

Also, a good tutorial/cookbook, especially for working with categories, is this one by Jeff, one of our core devs.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#7 2012-06-07 22:39:44

thijs
Member
Registered: 2012-04-17
Posts: 39

Re: making an image gallery / two questions

ok one more follow up question… let me know if you’re getting bored ;)

I have the following code, but I’m wondering how I can generate a link around the thumbnail. Currently they display as mere images. And I don’t want a thumbnail’s link element to link to the actual image, but rather to the same page, with that image on it, so the output href attribute should be something like:

domain.com/portfolio/?c=illustration&context=image&p=17

My question: from within the txp:image tag, what other tag can I use to get the corresponding thumbnails’ id? I don’t see this in the description of the image tag’s usage?

This is my code
<div id=“content” class=“gallery”> <txp:images category=”“ sort=“category asc” thumbnail=“1”> <a href=”****”><txp:thumbnail wraptag=“div” /></a> </txp:images>
</div>

I tried putting (in place of the asterisks) “&context=image&p=<txp:image_id />” but that obviously doesn’t work, as that tag does not exist.

Thanks in advance for any help.

edit: thanks Uli, I’ll take a look.

Last edited by thijs (2012-06-07 22:41:32)

Offline

#8 2012-06-08 00:22:47

thijs
Member
Registered: 2012-04-17
Posts: 39

Re: making an image gallery / two questions

ah… i found it (in zero’s thread one below mine)!

<txp:image_info type=“id” />

that’s was what i was looking for :)

thanks for all suggestions

Offline

#9 2012-06-08 00:28:39

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,315

Re: making an image gallery / two questions

thumbnail has its own link attribute. And for further creative applications of image data have a look at txp:image_info. Sorry for not helping any further ATM, it’s late here.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

Board footer

Powered by FluxBB