6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/rubyword/element/image.rb', line 6
def save(url, style=nil)
@images ||= Queue.new
filename = url.split('/').last
width, height = FastImage.size(url)
image_params = {
rid: @rubyword.init_rid,
path: url,
width: width,
height: height,
filename: filename
}
@images << image_params
@rubyword.images << image_params
@rubyword.rels_documents << {
Id: "rId#{@rubyword.init_rid}",
Type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
Target: "media/#{filename}"
}
@rubyword.init_rid = @rubyword.init_rid + 1
end
|