lib/html2doc/mime.rb in html2doc-0.8.3 vs lib/html2doc/mime.rb in html2doc-0.8.4

- old
+ new

@@ -57,11 +57,11 @@ end mhtml += "--#{boundary}--" File.open("#{filename}.doc", "w:UTF-8") { |f| f.write mhtml } end - # max height for Word document is 400, max width is 680 + # max width for Word document is 400, max height is 680 def self.image_resize(i, maxheight, maxwidth) realSize = ImageSize.path(i["src"]).size s = [i["width"].to_i, i["height"].to_i] s = realSize if s[0].zero? && s[1].zero? s[1] = s[0] * realSize[1] / realSize[0] if s[1].zero? && !s[0].zero? @@ -79,10 +79,10 @@ next if /^http/.match i["src"] matched = /\.(?<suffix>\S+)$/.match i["src"] uuid = UUIDTools::UUID.random_create.to_s new_full_filename = File.join(dir, "#{uuid}.#{matched[:suffix]}") FileUtils.cp i["src"], new_full_filename - i["width"], i["height"] = image_resize(i, 400, 680) + i["width"], i["height"] = image_resize(i, 680, 400) i["src"] = new_full_filename end docxml end