gbif / hosted-portals

Support material for establishing the GBIF Hosted Portals
Apache License 2.0
10 stars 6 forks source link

Get imageLicense from EXIF copyright tag #108

Closed jenningsdt closed 3 years ago

jenningsdt commented 3 years ago

Would it be possible to fill the imageLicense field using an image’s exif.image.copyright tag?

We would like to have a library of images from which to draw when creating news items etc. Right now, we need some sort of cross-reference document to know which image file goes with which imageLicense.

Instead, we would rather complete the exif.image.copyright field on each image and then have the hosted portal pull in the imageLicense information from that field.

This would make image management easier and would eliminate a source of human error.

MortenHofft commented 3 years ago

That is a nice idea.

Since this is just a theme for your Jekyll site, then you can extend it as needed. And if it is a general need that isn't easily solved by adding a plugin or configuring Jekyll, then we can also consider adding new features to the theme.

Ideas for how it could be done

Javascript seems like a bad solution. It would be adding kb with little gain and wouldn't be indexed.

A better solution seems to be a Jekyll plugin that extracts the information (for that the images probably need to be stored locally). Something similar to jekyll-exiftag. But since liquid cannot be used in yaml, then it would need to be combined with something like jekyll-liquify that allows Liquid in front matter.

MortenHofft commented 3 years ago

I've added the option to use Liquid in image caption and image background. https://github.com/gbif/hosted-portals/issues/113

I've added an example of usage to your repo https://github.com/gbif/hp-north-america/commit/f282e2ef3ed00f40cd469352b71c8a6dcf86d4c6

The interesting bits https://github.com/gbif/hp-north-america/blob/master/_data/images.yml https://github.com/gbif/hp-north-america/blame/master/home.md#L9

So the idea is that you can have a yaml file where you store all your image data (you can write a script to extract them from your images), and then reference that data file in your front matter.