Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2010-09-28 22:23:40

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: [howto] Using the new image tags in Txp 4.3.0

Bloke wrote:

Try adding a limit as a stop-gap. The problem is that by default the limit is 0 (“all”) which for reasons of vagaries in the code (line 2950 of taghhandlers.php) won’t actually trigger the offset to fire in the SQL. That should probably be changed but I think I tried it before and it fell apart under certain conditions. I could try again, or maybe someone else has some bright ideas.

That works! Now I just have to figure out a way to add a limit equal to X-1 where X is the number of image ids provided. There must be a txp:variable way to do that. Thanks again!

jsoo wrote:

soo_thumb_atts

Awesome! Thanks!

Offline

#26 2010-09-28 22:31:35

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: [howto] Using the new image tags in Txp 4.3.0

johnstephens wrote:

Now I just have to figure out a way to add a limit equal to X-1 where X is the number of image ids provided.

I take that back— providing a limit of any amount greater than or equal to the number of image ids works totally fine. (Just like the article tag, duh!) I could use the limit="99999" trick, but in this case 99 is more than enough.

Sorry for the slow draw, and thanks again!

Offline

#27 2010-09-29 03:37:10

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: [howto] Using the new image tags in Txp 4.3.0

Last question of the night: Is there any way to specify an deliberate, non-systematic sort order in the image_list tag? soo_image used the order of the given image ids to sort the output, but image_list defaults to name asc.

For the case I’m testing, I just renamed the files, but I can see how this wouldn’t be ideal in other implementations.

Offline

#28 2010-09-29 08:11:36

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,446
Website GitHub

Re: [howto] Using the new image tags in Txp 4.3.0

johnstephens wrote:

Is there any way to specify an deliberate, non-systematic sort order in the image_list tag?

Not without some trickery. You can use the MySQL1 cheat:

sort='FIELD(ID,5,3,2,4,1)'

but that’s not much use if you need the order to be read from the article_image itself. Now, if you were using a custom field then it’s easy:

sort='FIELD(ID,<txp:custom_field name="sort_order" />)'

But as I found to my detriment last night, the article_image field can’t just output its raw values: it always makes an image tag out of its content. Perhaps this is the last obstacle we need to address to make image handling complete: some way to tell article_image to output either:

  • the full <img> tag as normal from either the ID, name, or URL in the field
  • the fully qualified URL of its (sole) content
  • the raw value(s) in the field itself — like a custom field

I seem to remember having a go at doing this at the time I did the image_list system but failed to make it robust enough/useful/not confusing. If anybody wants to have a go at doing this quick-smart then it would be a useful fix as I think that’s the last area where upm_image outshines the new core tag suite.

1 Please note that this is a MySQL feature only (as far as I’m aware) which is not a problem now, but may be in the future of TXP if we start to support other DBs.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#29 2010-09-29 10:10:49

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,538
Website GitHub Twitter

Re: [howto] Using the new image tags in Txp 4.3.0

Bloke a écrit:

sort='FIELD(ID,<txp:custom_field name="sort_order" />)'

But as I found to my detriment last night, the article_image field can’t just output its raw values: it always makes an image tag out of its content. Perhaps this is the last obstacle we need to address to make image handling complete: some way to tell article_image to output either:

Hi Stef may be you can use article_image like this:

sort='FIELD(ID,<txp:custom_field name="article_image" />)'

must be work! (not tested)

Last edited by Dragondz (2010-09-29 10:12:58)

Offline

#30 2010-09-29 10:42:30

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

Re: [howto] Using the new image tags in Txp 4.3.0

We’ve rather drifted away from the topic, so I’ve answered in the Images are 1st class citizens of TXP thread.


Code is topiary

Offline

#31 2010-09-29 12:40:05

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

Re: [howto] Using the new image tags in Txp 4.3.0

And to get back on topic :)

In the demo I neglected to make full use of image_list’s nifty automatic context checking. I used it for article context, but not image category context. I’ve updated the demo to do so; results in cleaner code for the gallery example.

Textpattern gallery demo


Code is topiary

Offline

#32 2010-09-29 14:44:24

FireFusion
Member
Registered: 2005-05-10
Posts: 698

Re: [howto] Using the new image tags in Txp 4.3.0

I can’t get it to work with this line in the Javascript

document.getElementById('sooGalleryCaption').childNodes[0].nodeValue = showThis.title;

Offline

#33 2010-09-29 14:48:02

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

Re: [howto] Using the new image tags in Txp 4.3.0

Are you saying the demo site isn’t working correctly for you, or that you’ve tried to test it on your own server and it doesn’t work?


Code is topiary

Offline

#34 2010-09-29 14:55:02

FireFusion
Member
Registered: 2005-05-10
Posts: 698

Re: [howto] Using the new image tags in Txp 4.3.0

My own server. Firebug says

document.getElementById("sooGalleryCaption").childNodes[0] is undefined

Yet the images do have titles.

Last edited by FireFusion (2010-09-29 14:55:14)

Offline

#35 2010-09-29 15:04:50

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

Re: [howto] Using the new image tags in Txp 4.3.0

Right, but did you add an element for the caption, as in the example?

<p id="sooGalleryCaption"><txp:image_info /></p>

Code is topiary

Offline

#36 2010-09-29 15:07:30

FireFusion
Member
Registered: 2005-05-10
Posts: 698

Re: [howto] Using the new image tags in Txp 4.3.0

It’s ok. Fixed it. The element was blank on the first image. Thanks :)

Offline

Board footer

Powered by FluxBB