Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#13 2010-01-27 14:54:23
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Images are 1st class citizens of TXP
the_ghost wrote:
Can this work?
No, but you can try this:
<txp:variable name="if_thumb"><txp:article_image thumbnail="1" /></txp:variable>
<txp:if_variable name="if_thumb" value="">
<txp:else />
Yes, we have thumb
</txp:if_variable>
Offline
Re: Images are 1st class citizens of TXP
Bloke wrote:
Ah right. I see the issue. If you want to get at the extra info for an image in the article_image field you need to be able to output its ID (or name) so it can be injected into the relevant tag, e.g.:
<txp:image_info id='<txp:article_image show_me_the_damn_id="1" />' type="caption, alt" break="br" />
Yes, similar to the way smd_gallery works when using the ?article-image
value on id
attribute.
There is no current built-in (aka, a txp tag) way to get the values of the article_image field. As this article_image field is just like any other custom field (right?), it would be consistent to have a way to fetch the values inserted there. Something as simple as <txp:custom_field name="article_image" />
.
Offline
Offline
Re: Images are 1st class citizens of TXP
Gocom wrote:
It does? You are saing that your code doesn’t use globals? Shame.
Well, if the image has been seen before it should be cached so it might only be 1 DB call. But I think at the moment images are only cached if the txp:image tag is called. I’ll see how easy it is to cache the results in image_list too, thanks for waking me up!
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
Offline
Re: Images are 1st class citizens of TXP
I was thinking article_image supported comma seperated list of article IDs but maybe I’ve been using smd_gallery to long.
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
Re: Images are 1st class citizens of TXP
MattD wrote:
I was thinking article_image supported comma seperated list of article IDs but maybe I’ve been using smd_gallery to long.
From article_image()
:
$rs = safe_row('*', 'txp_image', 'id = '.intval($image));
$image
being the contents of the article-image field.
Yep, too much smd_koolaid for you.
I think all the image plugins with gallery functionality support comma-separated article-image field. Rather suggests this is an in-demand feature.
Code is topiary
Offline
Re: Images are 1st class citizens of TXP
MattD wrote:
I was thinking article_image supported comma seperated list of article IDs but maybe I’ve been using smd_gallery to long.
:-) I’d like that as well. Maybe one day it can be added. Don’t think it’ll kill any existing sites because they’d just continue to output one image.
But I’m currently pondering over maniqui’s thoughts on being able to output the article_image information in a raw format somehow. Can’t think of a clean way to do it at the moment. Any and all good ideas from anyone considered!
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
Re: Images are 1st class citizens of TXP
jsoo wrote:
$rs = safe_row(‘*’, ‘txp_image’, ‘id = ‘.intval($image));
Yes, so changing that to a MySQL IN list would work nicely. We’d need a break
attribute to be able to put something between each image, but I think that’d do it. Trouble is, doing it that way would mean there’ll be a lot of code duplication if file_image and link_image come to fruition. Mind you, there’ll be code duplication whichever way we go, so I suppose it’s not a massive problem. Hmmmmm.
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
Re: Images are 1st class citizens of TXP
Bloke wrote:
But I’m currently pondering over maniqui’s thoughts on being able to output the article_image information in a raw format somehow.
But that isn’t really what he’s asking for, is it? It’s only a means to getting at other fields for that image.
In my own image plugin, various tags default to the article image field if no id, category, or whatever is specified. The equivalent here would be to have image_list
behave this way: in the absence of id
, name
, and category
, grab the article image(s).
Code is topiary
Offline
Re: Images are 1st class citizens of TXP
jsoo wrote:
But that isn’t really what he’s asking for, is it? It’s only a means to getting at other fields for that image.
As Bloke stated, I’m asking for a way to use the value(s) inside article_image
field as attribute’s value on image_list
. Something like <txp:image_list id='<txp:article_image raw="1" />' />
(raw
is an invented attribute, similar to show_me_the_damn_id="1"
that Bloke suggested on a previous post).
In my own image plugin, various tags default to the article image field if no id, category, or whatever is specified. The equivalent here would be to have image_list behave this way: in the absence of id, name, and category, grab the article image(s).
That would be useful, particularly if, as in other TXP tags, it works inside an article_custom loop.
Offline
Re: Images are 1st class citizens of TXP
BTW, an alias for txp:image_*
so it could be written as txp:img_*
would be appreciated (at least, by me) :)
Offline