Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2019-10-05 10:50:25

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,760
Website

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

#2 2019-10-05 13:07:17

etc
Developer
Registered: 2010-11-11
Posts: 3,296
Website

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

#3 2019-10-05 13:40:03

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,760
Website

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

#4 2019-10-05 14:10:54

etc
Developer
Registered: 2010-11-11
Posts: 3,296
Website

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

#5 2019-10-05 14:24:22

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,760
Website

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

#6 2019-10-05 14:51:04

etc
Developer
Registered: 2010-11-11
Posts: 3,296
Website

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

#7 2019-10-05 15:01:32

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,760
Website

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

#8 2019-10-06 13:41:49

etc
Developer
Registered: 2010-11-11
Posts: 3,296
Website

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

#9 2019-10-06 14:59:57

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,760
Website

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

#10 2019-10-07 15:56:05

etc
Developer
Registered: 2010-11-11
Posts: 3,296
Website

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

Board footer

Powered by FluxBB