Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#91 2010-06-29 12:38:09
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,373
Re: soo_image: simple yet powerful image tags
Sorry, Jeff I meant to put txp:article_image /> in the standard TXP tag example above.
So if I don’t use soo_image_select then soo_image doesn’t pick up each individual “article image” in a list of articles as per the behaviour of txp:article_image?
The reason I was asking, was that I was hoping to replace all my instances of upm_article_image. So for a list of articles, instead of using:
<txp:article>
<txp:upm_article_image show_width="0" show_height="0" />
</txp:article>
I tried:
<txp:article>
<txp:soo_image width="0" />
</txp:article>
but it picks up the same image for each article, taken from a previous call of soo_image_select on the page. I don’t really understand the reasons for this “first article” thing you’re implementing so if it’s not possible for soo_image to automatically switch into “article image” mode is there any chance of a soo_article_image tag instead?
Thanks,
Adi
Offline
Re: soo_image: simple yet powerful image tags
gomedia wrote:
So if I don’t use
soo_image_selectthensoo_imagedoesn’t pick up each individual “article image” in a list of articles as per the behaviour oftxp:article_image?
Right; the approach I use for an article list is this:
Edit: — actually, I’ve used the same approach you’ve tried, and not had a problem — you seem to have uncovered a bug.
Last edited by jsoo (2010-06-29 14:14:24)
Code is topiary
Offline
Re: soo_image: simple yet powerful image tags
OK, not a bug exactly, but unusual behavior. I am contemplating an update that would address this, so that in your situation the soo_image tag will pick up the article image in preference to the leftover image from the earlier soo_image_select tag. However, with the change I have in mind, that leftover image will still appear if there is no article image. This is a behavior I use in other contexts.
So I think the best solution for your case is to use the code you posted earlier, noting that you could use an image form rather than container tag to save typing, hence:
<txp:article>
<txp:soo_image_select />
</txp:article>
assuming a default image form containing:
<txp:soo_image width="0" />
(also noting that the plugin has a preference setting to suppress width and height attributes by default).
Code is topiary
Offline
#94 2010-06-29 22:05:41
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,373
Re: soo_image: simple yet powerful image tags
Jeff,
What a shame, I was hoping for soo_image to be the one image plugin I’d need but if I’ve got to use extra source code, or an image form, or risk seeing leftover images then I’ll stick with upm_article_image.
Still no chance of soo_article_image then? I’m a big fan of source code readability &:
<txp:article>
<txp:soo_image_select>
<txp:soo_image width="0" />
</txp:soo_image_select>
</txp:article>
doesn’t scream “the article’s image” at me.
If you do produce an update to replicate txp:article_image or upm_article_image can I suggest that if the article’s “Article image” field is blank then you don’t generate leftover images. The field would be blank for a reason & that reason would be “this article doesn’t have an image” rather than “use a leftover image”.
All the best,
Adi
Offline
Re: soo_image: simple yet powerful image tags
Version 1.0.b.6 now official. It does not have a “soo_article_image” tag, because having such a tag would imply that soo_image can’t be used as a direct article_image substitute, which in fact it can. However, Adi, your desired code block:
<txp:article>
<txp:soo_image width="0" />
</txp:article>
can now be configured to behave as you want (i.e., show the first article image, or nothing), in one of two ways:
- by setting the plugin’s persistent context preference setting to off, or;
- specifying
persistent_context="0"in the priorsoo_image_selecttag.
Note that there’s also some code cleaning and that this version requires the newest version of the soo_txp_obj library plugin. Both plugins available on the soo_image download page.
Code is topiary
Offline
#96 2010-07-02 10:40:21
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,373
Re: soo_image: simple yet powerful image tags
jsoo wrote:
Version 1.0.b.6 now official.
Thanks Jeff, it works great. And just for the record, I’m using the following on the same page:
<txp:soo_image_select id="26,3,4,5,6,28,27,32,29,30,31,33,34">
<txp:soo_image />
</txp:soo_image_select>
<txp:article_custom>
<txp:soo_image />
</txp:article_custom>
<txp:soo_image id="22" />
The first displays all the images from the id="" list.
The second displays an image associated with an article (i.e. using the “Article image” field).
The third displays a specific image.
They all play nicely together & persistent_context="0" is only required in the soo_image_select tag if an article image field is empty (otherwise the first image from the id="" is displayed).
Offline
Re: soo_image: simple yet powerful image tags
Yes, I’m still rearranging deck chairs on the Titanic (see iceberg).
Version 1.0.b.7 now available. Adds thumbnail size attributes to img tags, if you like that sort of thing. (As with size attributes in full-size images, you can suppress this in the plugin’s preferences, or on a tag-by-tag basis.)
Code is topiary
Offline
#98 2010-12-18 15:45:57
- inkywillow
- Member

- From: France
- Registered: 2009-12-22
- Posts: 37
Re: soo_image: simple yet powerful image tags
Hi, I’m loving this plugin but have run up against a problem.
I currently have a page that displays an article with up to 3 images (minimum of 1), the layout has a main image with up to 3 thumbnails below it and the first thumbnail is of the main image above it. So when you click on a thumbnail the full size version replaces the main image. So far so good!
What I would like to do is place a conditional tag around the thumbnails so that they are only displayed if there is more than 1 image attached to the article. If there was only 1 image you wouldn’t need a thumbnail for it.
Is it possible to do this with this plugin?
Thanks…
Tom
The Design Works – Freelance website designer
Offline
Re: soo_image: simple yet powerful image tags
Not in a straightforward way. You could specify a separate form and listform for the soo_image_select tag that I presume you are using for the thumbnails, then create a blank form for the form. Kind of cheesy, and you’d still have any wrapping output — divs and so on — which you might not want.
If you’re using the article-image field to assign the images, you could throw in some raw PHP to parse it:
<txp:variable name="num_images"><txp:php>
global $thisarticle;
echo count(do_list($thisarticle['article_image']));
</txp:php></txp:variable>
<txp:if_variable name="num_images" value="1">
single image ...
<txp:else />
multiple (or zero) images ...
</txp:if_variable>
Show me the code you’re using and I’ll think about adding a new tag for this.
Code is topiary
Offline
#100 2010-12-18 17:14:12
- inkywillow
- Member

- From: France
- Registered: 2009-12-22
- Posts: 37
Re: soo_image: simple yet powerful image tags
Wow thanks for the super fast response, here’s the code…
<div class="entry-content">
<txp:soo_image_select limit="1">
<div id="mainimage-container"><txp:soo_image /></div>
</txp:soo_image_select>
<txp:soo_image_select>
<div id="single-item-thumb">
<txp:soo_image thumbnail="1" link_to="<txp:page_url type='s' />/<txp:url_title />" />
</div>
</txp:soo_image_select>
<div id="single-item-text"><txp:body /></div>
</div>
The Design Works – Freelance website designer
Offline
#101 2010-12-18 20:42:53
Re: soo_image: simple yet powerful image tags
Either of the solutions I gave above would work for this. I’m thinking about adding a soo_if_image_count tag, but it’s a more interesting problem than it might seem to come up with a good robust tag. Meanwhile:
Solution 1
<txp:soo_image_select form="blank" listform="thumbnails" />
Then the thumbnails form contains what you had in the tag:
<div id="single-item-thumb">
<txp:soo_image thumbnail="1" link_to='<txp:page_url type="s" />/<txp:url_title />' />
</div>
(Note the single quotes for the link_to attribute, and hence the double quotes for the type attribute.)
And make a form called blank, leaving it empty.
Solution 2
<txp:variable name="num_images"><txp:php>
global $thisarticle;
echo count(do_list($thisarticle['article_image']));
</txp:php></txp:variable>
<txp:soo_image_select>
<txp:if_variable name="num_images" value="1">
<txp:else />
<div id="single-item-thumb">
<txp:soo_image thumbnail="1" link_to='<txp:page_url type="s" />/<txp:url_title />' />
</div>
</txp:if_variable>
</txp:soo_image_select>
Code is topiary
Offline
#102 2010-12-18 23:44:05
Re: soo_image: simple yet powerful image tags
Version 1.0.b.8 available.
soo_image_select, when used without selection attributes (id, category, etc.) and outside article context will now check for global image-category context. †- New conditional tag,
soo_if_image_count. Allows checking the image count in (in order of priority):soo_image_selecttag or form- article images when in article context
- images in global image-category context †
So, Tom, you could now do this:
<txp:soo_if_image_count min="2">
<txp:soo_image_select>
<div id="single-item-thumb">
<txp:soo_image thumbnail="1" link_to='<txp:page_url type="s" />/<txp:url_title />' />
</div>
</txp:soo_image_select>
</txp:soo_if_image_count>
† Global image-category context available only in Txp 4.3.0 or later.
Last edited by jsoo (2010-12-19 15:46:06)
Code is topiary
Offline
#103 2010-12-19 10:47:12
- inkywillow
- Member

- From: France
- Registered: 2009-12-22
- Posts: 37
Re: soo_image: simple yet powerful image tags
Wow! What a response, thank you!
I’m still on Txp 4.2.0 for this website so I won’t be able to use the new version which is a shame because it looks great. Starting with my next project I’ll be using Txp 4.3.0. so I’ll definitely add this to the armory :)
I’m just about to have a play with the earlier solutions now so I’ll keep you posted.
Thanks again for your hard work…
Tom
The Design Works – Freelance website designer
Offline
#104 2010-12-19 10:54:25
- inkywillow
- Member

- From: France
- Registered: 2009-12-22
- Posts: 37
Re: soo_image: simple yet powerful image tags
Solution 1 worked a treat, well done you! :D
The Design Works – Freelance website designer
Offline
#105 2010-12-19 14:36:57
Re: soo_image: simple yet powerful image tags
inkywillow wrote:
I’m still on Txp 4.2.0 for this website so I won’t be able to use the new version which is a shame because it looks great. Starting with my next project I’ll be using Txp 4.3.0. so I’ll definitely add this to the armory :)
Heh, I should have tested the new version under Txp 4.2.0. No, scrub that — 1.0.b.8 is Txp-4.2.0 compatible.
Last edited by jsoo (2010-12-19 14:52:17)
Code is topiary
Offline