aerobless / jekyll-photo-gallery

Jekyll plugin to generate nice photo galleries easily.
112 stars 27 forks source link

Error at build: Invalid Date: '"\n ERROR, EXIF-Tag RB\n "' is not a valid datetime. #1

Closed aumars closed 6 years ago

aumars commented 7 years ago

I cloned the repository and built /sample-installation/, it immediately gave me this error:

[Liquid Exception: Invalid Date: '"\n ERROR, EXIF-Tag RB\n "' is not a valid datetime. in photography/Descent-into-the-Grand-Canyon-III/index.html
ERROR: YOUR SITE COULD NOT BE BUILT:
------------------------------------
Invalid Date: '"\n ERROR, EXIF-Tag RB\n "' is not a valid datetime.

I checked jekyll-exiftag-mod.rb and this is the if-statement that is causing the issue:

if File.exist?(img)
        file_name = img
      else
      # then start testing with the sources from _config.yml
        begin
          source = sources.shift
          file_name = File.join(context.registers[:site].config['source'], source, img)
        end until File.exist?(file_name) or sources.count == 0
      end
      # try it and return empty string on failure
      begin
        exif = EXIFR::JPEG::new(file_name)
        return tag.split('.').inject(exif){|o,m| o.send(m)}
      rescue
        "ERROR, EXIF-Tag RB"
      end

Any help would be greatly appreciated!

Sjlver commented 7 years ago

Got the same error.

For me, the fix was to replace line 1 of jekyll-exiftag-mod.rb, and include exifr/jpeg instead of exifr:

diff --git a/plugin/_plugins/jekyll-exiftag-mod.rb b/plugin/_plugins/jekyll-exiftag-mod.rb
index 18305f1..4afccdc 100644
--- a/plugin/_plugins/jekyll-exiftag-mod.rb
+++ b/plugin/_plugins/jekyll-exiftag-mod.rb
@@ -1,4 +1,4 @@
-require 'exifr'
+require 'exifr/jpeg'

 #Based on https://github.com/benib/jekyll-exiftag by Beni Buess (MIT License)
 #Edited to work as a Liquid-Block instead of a Liquid-Tag, reads the filename from between the
diff --git a/sample-installation/_plugins/jekyll-exiftag-mod.rb b/sample-installation/_plugins/jekyll-exiftag-mod.rb
index 18305f1..4afccdc 100644
--- a/sample-installation/_plugins/jekyll-exiftag-mod.rb
+++ b/sample-installation/_plugins/jekyll-exiftag-mod.rb
@@ -1,4 +1,4 @@
-require 'exifr'
+require 'exifr/jpeg'

 #Based on https://github.com/benib/jekyll-exiftag by Beni Buess (MIT License)
 #Edited to work as a Liquid-Block instead of a Liquid-Tag, reads the filename from between the
aerobless commented 6 years ago

@Sjlver Thanks 👍 I've applied your fix to the project!