@@ -20,7 +20,7 @@ def initialize file, options = {}, attachment = nil
2020 @geometry = options [ :geometry ]
2121 unless @geometry . nil?
2222 modifier = @geometry [ 0 ]
23- @geometry [ 0 ] = '' if [ '#' , '<' , '>' ] . includes ? modifier
23+ @geometry [ 0 ] = '' if [ '#' , '<' , '>' ] . include ? modifier
2424 @width , @height = @geometry . split ( 'x' )
2525 @keep_aspect = @width [ 0 ] == '!' || @height [ 0 ] == '!'
2626 @pad_only = @keep_aspect && modifier == '#'
@@ -41,28 +41,33 @@ def make
4141 ::Av . cli . add_source @file
4242 dst = Tempfile . new ( [ @basename , @format ? ".#{ @format } " : '' ] )
4343 dst . binmode
44-
45- cli = ::Av . cli ( quite : true )
46- cli . add_source ( @file . path )
47- cli . add_destination ( dst . path )
48- cli . reset_input_filters
49- if @convert_options [ :input ]
50- @convert_options [ :input ] . each do |h |
51- cli . add_input_param h
52- end
53- end
54- if @convert_options [ :output ]
55- @convert_options [ :output ] . each do |h |
56- cli . add_output_param h
44+
45+ if @meta
46+ log "Transocding supported file #{ @file . path } "
47+ cli = ::Av . cli ( quite : true )
48+ cli . add_source ( @file . path )
49+ cli . add_destination ( dst . path )
50+ cli . reset_input_filters
51+ if @convert_options . present?
52+ if @convert_options [ :input ]
53+ @convert_options [ :input ] . each do |h |
54+ cli . add_input_param h
55+ end
56+ end
57+ if @convert_options [ :output ]
58+ @convert_options [ :output ] . each do |h |
59+ cli . add_output_param h
60+ end
61+ end
5762 end
58- end
5963
60- begin
61- cli . run
62- log "Successfully transcoded #{ @base } to #{ dst } "
63- return dst # Things went fine, pass the file to paperclip for saving
64- rescue Cocaine ::ExitStatusError => e
65- raise Paperclip ::Error , "error while transcoding #{ @basename } : #{ e } " if @whiny
64+ begin
65+ cli . run
66+ log "Successfully transcoded #{ @base } to #{ dst } "
67+ return dst
68+ rescue Cocaine ::ExitStatusError => e
69+ raise Paperclip ::Error , "error while transcoding #{ @basename } : #{ e } " if @whiny
70+ end
6671 end
6772 # If the file is not supported, just return it
6873 @file
0 commit comments