Class | Paperclip::Tempfile |
In: |
lib/paperclip/processor.rb
|
Parent: | ::Tempfile |
Due to how ImageMagick handles its image format conversion and how Tempfile handles its naming scheme, it is necessary to override how Tempfile makes its names so as to allow for file extensions. Idea taken from the comments on this blog post: marsorange.com/archives/of-mogrify-ruby-tempfile-dynamic-class-definitions
# File lib/paperclip/processor.rb, line 45 45: def make_tmpname(basename, n) 46: case basename 47: when Array 48: prefix, suffix = *basename 49: else 50: prefix, suffix = basename, '' 51: end 52: 53: t = Time.now.strftime("%y%m%d") 54: path = "#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}-#{n}#{suffix}" 55: end