lib/reverse_adoc/converters/img.rb in reverse_adoc-0.2.10 vs lib/reverse_adoc/converters/img.rb in reverse_adoc-0.3.0
- old
+ new
@@ -1,10 +1,10 @@
require "fileutils"
require "pathname"
require "tempfile"
require "base64"
-require "mimemagic"
+require "marcel"
module ReverseAdoc
module Converters
class Img < Base
@@ -48,10 +48,10 @@
def copy_temp_file(imgdata)
Tempfile.open(['radoc', '.jpg']) do |f|
f.binmode
f.write(Base64.strict_decode64(imgdata))
f.rewind
- ext = MimeMagic.by_magic(f).subtype
+ ext = Marcel::MimeType.for(f).sub(%r{^[^/]+/}, "")
[ext, f.path]
end
end
def convert(node, state = {})