Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2023-04-29 16:45:47
- From: Maryland, USA
- Registered: 2007-08-12
- Posts: 99
The barebones, dummy-proof usage of smd_thumbnail in articles
I searched before asking and see measures are being taken to resize and crop in other ways – I’m not too code-knowing so I’ll have to wait. I have two smd_thumbnail Profiles: Horizontal and Vertical; and just a few images. I’ve successfully created and accepted/Saved Vertical for image 1 – it’s in images/Vertical/1.jpg which is probably no surprise.
In an Article, where I want a Thumbnail/resized image 1 from that Vertical folder in images, <txp:smd_thumbnail id=“1” /> cringe Am I stabbing in the right direction?
(Returning to TXP after years away. Always an admirer, but I was never one of the brightest users.)
Voice Actor – starting up a site for that good book stuff.
#2 2023-04-29 17:01:22
Re: The barebones, dummy-proof usage of smd_thumbnail in articles
If you’re using smd_thumbnail you’ll want to use
<smd::thumbnail type="Vertical" /> to grab that particular profile.
However, it depends how you’re calling it as to whether you use the
id attribute or wrap it in a @<txp:images /> tag.
I heartily recommend the com_article_image plugin for more integrated image handling from the Write panel. And if you’ve assigned one or more thumbs to an article, in your Form that handles content display, do this:
<if::article_image> <txp:images> <smd::thumbnail type="vertical" /> </txp:images> </if::article_image>
You can specify
limit="1" in the images tag if you only want to grab the first image assigned. Or, you can use the
size attribute to filter the images by aspect first (e.g.
size="portrait") but I’m not sure how that transfers into the plugin.
Edit: note to self… Document the new attributes.
Last edited by Bloke (2023-04-29 17:02:36)
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