kolber / stacey

Cheap & easy content management
http://staceyapp.com
MIT License
1.04k stars 132 forks source link

Support for optional external metadata file for images #139

Open docphees opened 9 years ago

docphees commented 9 years ago

IPTC data is slowly fading and proper editors are not easy to find these days, so I decided to add support for external metadata files:

USING AN EXTERNAL DATA FILE FOR METADATA (TITLE, DESCRIPTION, KEYWORDS)
### Since IPTC data is a bit old fashioned I implemented a way to store the metadata
### in an external text file.
### This uses a .dat file named like this:
### If the image name is "2001_23.jpg",
### the datfile name is "2001_23.jpg.dat"
###
### The Datfile may have up three lines:
### Line 1: Title
### Line 2: Description
### Line 3: Keywords
###
### Example:
### -------file-------
### Portrait Of Foo's Mother
### Oil on drywall, 2015
### painting grafitti
### ------------------
docphees commented 9 years ago

The change does only kick in if there is a .dat file present. If not, the IPTC data will be used as before. If a .dat file is present, it will overwrite the metadata fields, or "wins" against already present IPTC data.

mjau-mjau commented 9 years ago

That is an interesting concept. You are aware that Stacey already supports metadata stored directly in the page yml file? For example:

title: title be here

filename.jpg:
  title: Some title here
  description: Some description here
another-image.jpg:
  title: Some title here
  description: Some description here

Not saying this is better than your method, but I would imagine it requires less processing on server since it doesn't need to open files for each image in the page.

docphees commented 9 years ago

Actually, I was not aware of it :)

I am using this solution, as I am hosting a few pages for artists and this way I can let them edit the image and plain text files, send them over and simply drop them into the according directory. I will have a more thorough look at your method.

The overhead for opening the text files is there, but will only happen if there is no exif data. And also it is being cached as far as I see. I will have to run a test with more files.

Thanks!