Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
smd_img_alt: Boilerplate alt text with automatic replacements
Uploading images en-masse is a pain, especially for sites with many of them. As well as uploading the images (such as product photos), you should supply meaningful alt text for each, which is an overhead. This plugin may ease the drudgery.
Simply install it, create a form called smd_img_alt
and type boilerplate alt text, one per row. These entries will appear below your alt text box, and selecting one of the items will copy the text immediately up into the box for you to customise before saving.
On its own, this may seem contrived but there’s an additional ace up the plugin’s sleeve: replacements. If you have, for example, dragged a bunch of images into an article using the com_article_image plugin and saved the article, if you then visit the Image Edit panel for each of the pictures, the plugin has access to all the article field data in the associated article.
In your boilerplate definitions Form, you can include replacement field names such as {custom_3}
. These will be replaced immediately when the panel is loaded with the corresponding value from the associated article. Handy for adding product names, features, serial numbers and so forth to your alt texts without needing to type much more.
This is really beneficial if you’re taking standard product shots (side elevation, top, bottom, etc) and want your alt text to be more meaningful.
Download the plugin from GitHub and have a play. Feedback or issues welcome.
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: smd_img_alt: Boilerplate alt text with automatic replacements
This looks great!! I’ll give it a try.
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: smd_img_alt: Boilerplate alt text with automatic replacements
Very useful.
Thank you very much.
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
Re: smd_img_alt: Boilerplate alt text with automatic replacements
Thanks. Would love to know your feedback. It’s still early days.
A few random ideas for further development:
- Allow the Form to be parsed so txp tags can be used in the replacements. I couldn’t manage this easily now because
parse_form()
doesn’t work (no theme/skin set for some reason) and even if it did work,parse()
isn’t available on the admin side unless I include txplib_publish.php, which is a yucky thing to have to do. - Allow different types of form content, perhaps dependent on some image attribute. e.g. if the image is attached to an article in section ‘blog’ then use the smd_img_alt_blog list of replacements. But if it’s in articles then use smd_img_alt_articles. And if a dedicated list doesn’t exist, fall back on the vanilla set.
- As above, but instead of separate forms, maybe allow the smd_img_alt form to be segmented like an ini file:
[blog]
string 1
string 2
[articles]
string 3
string 4
string 5
[SMD_ALL]
common text 1
common text 2
...
Dunno yet. Will depend if there’s a need for more fine-grained control.
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: smd_img_alt: Boilerplate alt text with automatic replacements
All models based on section/article dependence will be mostly appreciated (same thing relative to the upcoming unlimited custom fields). IMHO.
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline