Method: EmbeddedFile::Loader#load_image

Defined in:
lib/asker/loader/embedded_file/loader.rb

#load_image(value, localdir) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/asker/loader/embedded_file/loader.rb', line 65

def load_image(value, localdir)
  filepath = File.join(localdir, value)
  output = {}
  output[:text] = '<img src="@@PLUGINFILE@@/' + File.basename(filepath) \
                  + '" alt="imagen" class="img-responsive atto_image_button_text-bottom">'
  output[:file] = '<file name="' + File.basename(filepath) \
                  + '" path="/" encoding="base64">' \
                  + Base64.strict_encode64(File.open(filepath, "rb").read) \
                  + "</file>"
  output[:type] = :image
  output[:url] = value
  output
end