Textpattern CMS support forum

You are not logged in. Register | Login | Help

#91 2010-06-29 12:38:09

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,227
Website

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

#92 2010-06-29 14:04:45

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,781
Website

Re: soo_image: simple yet powerful image tags

gomedia wrote:

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?

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

#93 2010-06-29 17:29:36

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,781
Website

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,227
Website

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

#95 2010-07-02 02:23:26

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,781
Website

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:

  1. by setting the plugin’s persistent context preference setting to off, or;
  2. specifying persistent_context="0" in the prior soo_image_select tag.

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,227
Website

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

#97 2010-07-04 21:47:53

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,781
Website

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.)

Downloads, etc.


Code is topiary

Offline

#98 2010-12-18 15:45:57

inkywillow
Member
From: France
Registered: 2009-12-22
Posts: 37
Website

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

#99 2010-12-18 16:37:33

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,781
Website

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
Website

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

Board footer

Powered by FluxBB