eltiare / carrierwave-vips

CarrierWave image processing powered by VIPS
MIT License
92 stars 39 forks source link

Carrierwave vips won't process files with a number in the extension #11

Closed cgat closed 11 years ago

cgat commented 11 years ago

Believe it or not, an image extension exists with a number in it. Hasselblad uses the "3FR" extension on their raw files.

Specifically in the process! method in vips.rb:

def process!(*)
  ret = super
  if @_vimage
    tmp_name = current_path.sub(/(\.[a-z]+)$/i, '_tmp\1')
    writer = writer_class.send(:new, @_vimage, @_format_opts)
    if @_strip
      writer.remove_exif
      writer.remove_icc
    end
    writer.write(tmp_name)
    FileUtils.mv(tmp_name, current_path)
    @_vimage = nil
  end
  ret
end

Line tmp_name = current_path.sub(/(\.[a-z]+)$/i, '_tmp\1') needs to be changed to tmp_name = current_path.sub(/(\.[[:alnum:]]+)$/i, '_tmp\1')