Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Image-related tags: some ideas
Game on!
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
Online
Re: Image-related tags: some ideas
michaelkpate wrote #304464:
They don’t seem to be mentioned in any of the early changelogs so apparently they date all the way back to when Textpattern was totally Dean’s vision. I can’t remember when the last time was I used them or imagine why I would.
+1… and both Michael and I have been around for some time!
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Image-related tags: some ideas
image
and thumbnail
prioritise name
over id
. image_info
et. al are the other way round. Rather gets in the way of my idea of using imageFetchInfo()
as a helper to include the logic of id
> name
> $thisimage
[ > @$p ]. I can see a few ways of dealing with this:
- Trigger a warning if both
name
andid
are set; - Trigger an error if both
name
andid
are set; - Deal with it in
imageFetchInfo()
somehow or other (awkward but doable); - Change
image
andthumbnail
to match the other tags. (Combined with 1 or 2.)
I prefer #4 and #1 combined. Thoughts?
Code is topiary
Offline
Re: Image-related tags: some ideas
jsoo wrote #304471:
I prefer #4 and #1 combined. Thoughts?
I’m down with that, for sure. I’d be tempted to standardise the pecking order with whatever is most common across other tags.
IIRC, the only problem with the <txp:images>
tag is that name
and id
make a union don’t they? It’s not one or the other but both that get added to the image pool? I might be wrong. Been a while. Does that affect anything, or is it separate from the method of processing for <txp:image>
and <txp:thumbnail>
tags?
At the back of my mind is that <txp:images>
uses auto_detect unless you specify one or more of name
, id
, category
, author
, realname
. And then it adds all matching items to the pool and then applies the other attributes to the result. As I say, might be wrong, I haven’t looked at the code there since about 4.3.0.
If that behaviour is specific to <txp:images>
then yeah, go with one or the other attribute as priority for the remaining image tags. The only people it’ll affect are those using both name
and id
together, and they’re doing it wrong.
Last edited by Bloke (2017-03-06 22:43:07)
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
Online
Re: Image-related tags: some ideas
Bloke wrote #304472:
IIRC, the only problem with the
<txp:images>
tag is thatname
andid
make a union don’t they? It’s not one or the other but both that get added to the image pool? I might be wrong. Been a while. Does that affect anything, or is it separate from the method of processing for<txp:image>
and<txp:thumbnail>
tags?
Yes, separate method; I’m only talking about tags that can only retrieve a single image by themselves.
I can’t find a suitable gTxt error for having two attributes in conflict, so I’ll leave that for now.
Code is topiary
Offline
Re: Image-related tags: some ideas
Bloke wrote #304472:
At the back of my mind is that
<txp:images>
uses auto_detect unless you specify one or more ofname
,id
,category
,author
,realname
. And then it adds all matching items to the pool and then applies the other attributes to the result. As I say, might be wrong, I haven’t looked at the code there since about 4.3.0.
The site I have been working on lately makes extensive use of smd_thumbnail and I find most anywhere I use it to get display an article image I end up with code like this:
<txp:images>
<txp:smd_thumbnail type="hero" class="single-post-img" />
</txp:images>
In order to avoid:
Tag error: <txp:smd_thumbnail type="hero" class="single-post-img" /> -> Textpattern Notice: Unknown image while parsing form default on page articles
This seems kind of redundant to me but at least it makes the error go away.
Offline
Re: Image-related tags: some ideas
michaelkpate wrote #304474:
In order to avoid… Unknown image while parsing form default on page articles…
Does this work instead?
<txp:if_article_image>
<txp:smd_thumbnail ... />
</txp:if_article_image>
Can’t remember if smd_thumbnail treats article images as comma-separated lists in the event there are many specified. If not, then the only way to guarantee a gallery would be to wrap it in <txp:images>
as you have.
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
Online
Re: Image-related tags: some ideas
Bloke wrote #304485:
Does this work instead?
Tag error: <txp:smd_thumbnail type="hero" class="single-post-img" /> -> Textpattern Notice: Unknown image while parsing form default on page articles
So just for fun I now made the code:
<txp:if_article_image>
<txp:images>
<txp:smd_thumbnail type="hero" class="single-post-img" />
</txp:images>
</txp:if_article_image>
Offline
Re: Image-related tags: some ideas
michaelkpate wrote #304486:
Tag error...
Drat, thought the plugin was better than that, though it is reusing a lot of built-in Txp functionality that throws errors if it can’t find stuff.
I’ll add it to the list of things to investigate… thanks for the heads-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
Online