Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for optional external metadata file for images #139

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

docphees
Copy link

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

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

None yet

2 participants