Method: Documatic::OpenDocumentText::Template#add_image

Defined in:
lib/documatic/open_document_text/template.rb

#add_image(full_path) ⇒ Object

Add an image to the current template. The argument is the path and filename of the image to be added to the template. This can be an absolute path or a relative path to the current directory. Returns the basename of file if it exists; otherwise an ArgumentError exception is raised.



181
182
183
184
185
186
187
188
189
# File 'lib/documatic/open_document_text/template.rb', line 181

def add_image(full_path)
  if File.exists?(full_path)
    image = File.basename(full_path)
    self.images[image] = full_path
    return image
  else
    raise ArgumentError, 'Attempted to add non-existent image to template'
  end
end