Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#85 2010-06-20 07:10:47

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

Re: soo_image: simple yet powerful image tags

Hi Jeff,

Your plugin looks great but I must be having “one of those days”. My code is:

<txp:soo_image_select id="9,5,7,17,8,18,19,6,10,20,21,22">
	<txp:soo_image width="0" />
	<txp:soo_image_caption />
</txp:soo_image_select>

but the <img /> tags that are generated still contain the width & height attributes.

… and I have a request. Could the <txp:soo_image_caption /> have a wraptag attribute? Some of my images have captions, some don’t. So if there’s a caption then output it inside the wraptag, if not, output nothing.

Thanks,

Adi

Last edited by gomedia (2010-06-20 11:18:14)

Offline

#86 2010-06-20 12:36:14

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

Re: soo_image: simple yet powerful image tags

Adi: I’m on the road today and will look into this tomorrow.


Code is topiary

Offline

#87 2010-06-21 19:42:20

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

Re: soo_image: simple yet powerful image tags

Adi: thanks for the bug report and request. Version 1.0.b.5 now available; <txp:soo_image width="0" /> should now work as expected, and all of the tags for outputting image info now accept standard wraptag, class, and html_id attributes.


Code is topiary

Offline

#88 2010-06-21 23:15:27

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

Re: soo_image: simple yet powerful image tags

jsoo wrote:

Version 1.0.b.5 now available; <txp:soo_image width="0" /> should now work as expected, and all of the tags for outputting image info now accept standard wraptag, class, and html_id attributes.

Jeff, you’re a star, thanks. Does the job very nicely.

All the best,

Adi

Offline

#89 2010-06-29 11:08:28

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

Re: soo_image: simple yet powerful image tags

Hi Jeff,

Just been trying soo_image within an article form. Have I got this right?

Standard TXP:

<txp:article>
	<txp:image />
</txp:article>

Using soo_image:

<txp:article>
	<txp:soo_image_select>
		<txp:soo_image width="0" />
	</txp:soo_image_select>
</txp:article>

I always hope that plugins reduce the amount of typing! Am I missing something?

Cheers,

Adi

Offline

#90 2010-06-29 12:05:53

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

Re: soo_image: simple yet powerful image tags

If you’re looking for the equivalent of this:

<txp:article>
	<txp:article_image />
</txp:article>

You can use this as a shortcut:

<txp:article>
	<txp:soo_image />
</txp:article>

because soo_image, outside a soo_image_select and without identifiers (i.e., name or id attribute) automatically picks up the (first) article image.


Code is topiary

Offline

#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

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

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
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,793
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,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

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

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
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,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

Board footer

Powered by FluxBB