Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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_select
tag 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
#106 2010-12-19 15:02:04
- inkywillow
- Member
- From: France
- Registered: 2009-12-22
- Posts: 37
Re: soo_image: simple yet powerful image tags
Blimey, you don’t hang about do you? ;-)
You can see it in action here http://gideonzadoks.com/
Obviously not finished yet but your bit is working OK! See Furniture —> Item1
Thanks again for you help… (let me know your pp details, I think a donation is in order come payday)
The Design Works – Freelance website designer
Offline
#107 2018-05-23 12:23:57
Re: soo_image: simple yet powerful image tags
Hi,
i have made a new-install of Textpattern 4.7.0 and install the Plugin soo_image (Version 1.0.b.9)
I getting the error:
A problem occurred while loading the plugin: soo_image -> User_Error: Unable to include plugin {$name}. on line 1420
Last edited by lythande (2018-05-23 12:31:56)
Offline
#108 2018-05-23 12:43:04
Re: soo_image: simple yet powerful image tags
Oh, my wrong. I forgotten to install the soo_txt_obj, which soo_image need as requirement… Sorry, now the error is away :-)
Offline