Sha256: ce692c99b93dec2246ee96fbbadd401a19b0b7c9ea7a0f898f650502c8d409f9

Contents?: true

Size: 1.72 KB

Versions: 17

Compression:

Stored size: 1.72 KB

Contents

# view_exif.rb  $Revision: 1.0.0 $
#
# Copyright (c) 2013 N.KASHIJUKU <n-kashi[at]whi.m-net.ne.jp>
# You can redistribute it and/or modify it under GPL2.
#
#  http://www1.whi.m-net.ne.jp/n-kashi/recent_image.htm
#
# !caution! view_exif.rb needs recent_image.rb
#
require 'exifparser'

# PLUGIN body
#     view_exif() ... input EXIF datas of images in your diary.
#
def view_exif(id = 0, exifparam ="")
  init_rcimg if @recent_image_hash == nil or @recent_image_hash.length == 0

  begin
    @image_date_exif ||= @date.strftime("%Y%m%d")
    @exifparser = ExifParser.new(%Q[#{@image_dir}/#{@recent_image_hash[@image_date_exif+"_"+id.to_s].file}].untaint)

    if exifparam == ""    # return a formatted string.
      model             = @exifparser['Model'].to_s
      focallength       = @exifparser['FocalLength'].to_s
      fnumber           = @exifparser['FNumber'].to_s
      exposuretime      = @exifparser['ExposureTime'].to_s
      isospeedratings   = @exifparser['ISOSpeedRatings'].to_s
      exposurebiasvalue = @exifparser['ExposureBiasValue'].to_s
      if @exifparser.tag?('LensParameters')
        lensname        = "("+ @exifparser['LensParameters'].to_s + ")"
      else
        lensname        = ""
      end
      return %Q[<div class="exifdatastr"><p>#{model}, #{focallength}, #{fnumber}, #{exposuretime}, ISO#{isospeedratings}, #{exposurebiasvalue}EV #{lensname}</p></div>]
    else                  # return the requested value.
      return @exifparser[exifparam.untaint].to_s
    end

  rescue
    exp = ($!).to_s + "<br>"
    ($!).backtrace.each do |btinfo|
      exp += btinfo
      exp += "<br>"
    end
    return exp
  end
end


#  Callback Functions

add_body_enter_proc do |date| 
  @image_date_exif = date.strftime("%Y%m%d")
  ""
end

Version data entries

17 entries across 16 versions & 2 rubygems

Version Path
tdiary-contrib-5.3.0 util/image-gallery/misc/plugin/view_exif.rb
tdiary-contrib-5.2.4 util/image-gallery/misc/plugin/view_exif.rb
tdiary-contrib-5.2.3 util/image-gallery/misc/plugin/view_exif.rb
tdiary-contrib-5.2.2 util/image-gallery/misc/plugin/view_exif.rb
tdiary-contrib-5.2.1 util/image-gallery/misc/plugin/view_exif.rb
tdiary-contrib-5.2.0 util/image-gallery/misc/plugin/view_exif.rb
tdiary-contrib-5.1.7 util/image-gallery/misc/plugin/view_exif.rb
tdiary-contrib-5.1.6 util/image-gallery/misc/plugin/view_exif.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-contrib-5.1.4/util/image-gallery/misc/plugin/view_exif.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/bundler/gems/tdiary-contrib-d1e41204db13/util/image-gallery/misc/plugin/view_exif.rb
tdiary-contrib-5.1.5 util/image-gallery/misc/plugin/view_exif.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-contrib-5.1.4/util/image-gallery/misc/plugin/view_exif.rb
tdiary-contrib-5.1.4 util/image-gallery/misc/plugin/view_exif.rb
tdiary-contrib-5.1.3 util/image-gallery/misc/plugin/view_exif.rb
tdiary-contrib-5.1.2 util/image-gallery/misc/plugin/view_exif.rb
tdiary-contrib-5.1.1 util/image-gallery/misc/plugin/view_exif.rb
tdiary-contrib-5.1.0 util/image-gallery/misc/plugin/view_exif.rb