0.01
No commit activity in last 3 years
No release in over 3 years
Provides exif data for images in Jekyll websites via a Liquid filter
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 0
>= 0

Runtime

~> 1.3
 Project Readme

Jekyll-exif-data

Gem Version

This Jekyll plugin adds the Liquid filter exif, supplying exif data to Jekyll websites. To read the data exifr is used as a dependency.

Installation

Add the plugin to your site's Gemfile:

group :jekyll_plugins do
  # your other jekyll plugins...
  gem 'jekyll-exif-data', '~> 0.0'
end

Then run

$ bundle install

in your jekyll project directory. The dependency of the plugin is also automatically installed by this command.

Manual installation

In your terminal:

$ gem install jekyll-exif-data

Then add the plugin to your _config file:

plugins:
  - jekyll-exif-data

Usage

{{ image_path | exif: '[exif-tag]'}}

The exif filter takes the exif tag as the argument and acts on the image (path without leading slash).

Examples:

{% assign image_path = "assets/my_image.jpg" %}
{{ image_path | exif: 'model'}}
{{ "assets/images/example.jpg" | exif: 'date_time' | date: "%Y" }}

For more examples of possible exif tags see exifr. The argument taken by the exif filter is the name of the method in exifr (for deeper methods join them with a dot e.g. gps.latitude or f_number.to_f).

You can use the arguments exif? and gps? to figure out whether there is any exif/gps data for your image. The code shown below links to the location on https://www.openstreetmap.org where the image was taken and additionally provides the model of the camera used and the year.

{% capture has_exif %}{{ image-path-no-leading-slash | exif: "exif?" }}{% endcapture %}
{% capture has_gps %}{{ image-path-no-leading-slash | exif: "gps?" }}{% endcapture %}
{% if has_exif %}
    Taken
    {% if has_gps=="true" %}
        <a href="https://www.openstreetmap.org/?mlat={{ image-path-no-leading-slash | exif: 'gps.latitude' }}&mlon={{ image-path-no-leading-slash | exif: 'gps.longitude' }}&zoom=8&layers=M" target="_blank">here </a>
    {% endif %}
    with a {{ image-path-no-leading-slash | exif: 'model' }}
    in {{ image-path-no-leading-slash | exif: 'date_time' | date: "%Y" }}.
{% endif %}

If the exif tag exists, but there is no value saved for it an empty String is returned opposed to nil by exifr.