Skip to content

Support for optional external metadata file for images#139

Open
docphees wants to merge 1 commit into
kolber:masterfrom
docphees:master
Open

Support for optional external metadata file for images#139
docphees wants to merge 1 commit into
kolber:masterfrom
docphees:master

Conversation

@docphees

Copy link
Copy Markdown

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
### ------------------

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

Copy link
Copy Markdown
Author

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

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants