Sha256: 7897c50ba05e90c2e4f85e1b00dbd333697dbd681bd49987dec0378dd991f8aa

Contents?: true

Size: 418 Bytes

Versions: 2

Compression:

Stored size: 418 Bytes

Contents

require 'tempfile'
require 'base64'

module Gnawrnip
  module Photographer
    def animation(paths)
      raise NotImplementedError
    end

    def single(path)
      image_tag(image_base64(path))
    end

    def image_base64(path)
      Base64.strict_encode64(File.read(path))
    end

    def image_tag(data, format = :png)
      '<img src="data:image/' + format.to_s + ';base64,' + data + '"/>'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gnawrnip-0.1.2 lib/gnawrnip/photographer.rb
gnawrnip-0.1.1 lib/gnawrnip/photographer.rb