Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
smd_meta_image: create image/article metadata via IPTC on upload
For photobloggers or those that employ IPTC data in their images, this plugin is for you.
This plugin will allow you to upload your tagged images and populate image metadata from IPTC header information of your choice. If configured, the plugin will also automatically create an article for each uploaded image and populate the chosen fields with content from the image; automatically creating one article per image.
Features:
- Map image IPTC fields to Textpattern image/article fields.
- Articles may be created automatically based on embedded IPTC data.
- Article/image categories may be created automatically if required.
- Upload/replace images to update Textpattern metadata.
Requires Textpattern 4.7+
Download the latest version of the plugin from GitHub
Once installed and activated, visit the Admin->Preferences panel and click the Meta Image Import group to configure the plugin. The documentation goes into detail, but the gist is that you map image/article fields in Textpattern to information stored in the incoming IPTC fields. After setting up your mapping, when you upload/replace images and check the Parse IPTC data checkbox your image/article data will be inserted or updated into Textpattern.
Many thanks to Kjeld Duits who proposed the original plugin idea and has spent considerable time during development testing, and helping me refine the plugin.
As always, any bugs and features, please raise an issue or discuss the plugin below.
Hope it proves useful.
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: smd_meta_image: create image/article metadata via IPTC on upload
Wow, what a masterpiece, pity I’m not a photographer! The most difficult part was to find a IPTC-enhanced image, the rest is automagic. Can smd_meta_image
optionally create only one “parent” article on batch image upload?
Offline
Re: smd_meta_image: create image/article metadata via IPTC on upload
etc wrote #319534:
Can
smd_meta_image
optionally create only one “parent” article on batch image upload?
It was on my list but I couldn’t find a callback that allowed me to know when all the images had been uploaded so I could trigger the article creation. Plus, which image would be used for the metadata to populate the article? The first? The last?
Any ideas welcome as I think it’d be a really handy thing for wedding photographers or those that want one article and a gallery created.
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: smd_meta_image: create image/article metadata via IPTC on upload
Bloke wrote #319536:
It was on my list but I couldn’t find a callback that allowed me to know when all the images had been uploaded so I could trigger the article creation.
Yep, it looks like we should introduce a new callback.
Plus, which image would be used for the metadata to populate the article? The first? The last?
I guess it would be the first one, for consistency with <txp:article_image />
?
Offline
Re: smd_meta_image: create image/article metadata via IPTC on upload
etc wrote #319537:
looks like we should introduce a new callback.
Yes please!
I guess it would be the first one, for consistency with
<txp:article_image />
?
Yes. But when I was testing dragging/dropping a bunch of images it didn’t always seem to be the first one that uploaded that was assigned the lowest id. I think it was the first that finished, which may have been the smallest? I didn’t test extensively as it wasn’t important to the plugin functionality so I may be wrong.
If we have an ‘all done’ callback it should probably supply the ids or order of the images as they were presented to the upload box, if that’s possible.
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: smd_meta_image: create image/article metadata via IPTC on upload
Bloke wrote #319538:
If we have an ‘all done’ callback it should probably supply the ids or order of the images as they were presented to the upload box, if that’s possible.
That’s not a one-liner, though must be possible. But the order of the images in the input box does not seem to be freely alterable (at least on W10) – it’s the current file system order (name, size and so on).
Offline
Re: smd_meta_image: create image/article metadata via IPTC on upload
etc wrote #319539:
the order of the images in the input box does not seem to be freely alterable
Hmmm, right. That’s what I feared. I have seen drag n drop interfaces for multi upload that adds them to a ‘list’ (e.g. PLupload) so, as you say, there must be a way to transmit that somehow.
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: smd_meta_image: create image/article metadata via IPTC on upload
Bloke wrote #319540:
I have seen drag n drop interfaces for multi upload that adds them to a ‘list’ (e.g. PLupload) so, as you say, there must be a way to transmit that somehow.
We’d have to develop a UI for this, Plupload does not seem to use the standard <input />
.
Offline
Re: smd_meta_image: create image/article metadata via IPTC on upload
etc wrote #319545:
We’d have to develop a UI for this, Plupload does not seem to use the standard
<input />
.
Ah, maybe that’s how they do it then. Shame. It’s not an absolute deal breaker as long as we make it clear that the first image – alphabetically – is the one that is going to get have its metadata used. That’s not too unreasonable given the undeterminant nature of the standard browser multi-upload process.
The key thing is that we have a) a core callback trigger that all uploads are done, and b) either present the file(name)s, in order, as a parameter within that callback, or have the plugin collate the filenames during each uploaded file, so the “first” one can be determined at trigger time.
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: smd_meta_image: create image/article metadata via IPTC on upload
I’ve done few tests. The easiest way atm is to send some fileInputOrder
value along with each file. So, when you get gps(fileInputOrder) == 1
you know this file/image was the “first” one. Later, when we provide a UI, this value could be set on upload via (say) rearranging files icons in the drop zone.
Offline
Re: smd_meta_image: create image/article metadata via IPTC on upload
etc wrote #319574:
The easiest way atm is to send some
fileInputOrder
value along with each file.
That’s perfect, good idea. The plugin can do this:
- If you set a pref to generate one article per file, it works as it does now.
- If you set that pref to generate one article per group of files, it will:
- Gather the filenames and create the images as it goes, as normal.
- Detect which one has
fileInputOrder === 1
and call the article creation only for that image.
Easy! There’s not even any need to have a new callback in this case to trigger when they’re all done, as it can still do it as it receives each file.
Edit: Wait, yes it does need the callback as it needs to update the article to inject all the image IDs into the article_image field when they’re all uploaded, in the order they are presented to the <input/>
box.
Last edited by Bloke (2019-10-07 16:04:37)
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: smd_meta_image: create image/article metadata via IPTC on upload
A new callback could be useful if you want to associate all batch-uploaded images to the new article, rearranging their ids as you need. Yep
Offline