mirror of
https://github.com/kemko/paperclip.git
synced 2026-01-01 16:05:40 +03:00
Add extension to original file on reprocess
This commit is contained in:
@@ -314,7 +314,10 @@ module Paperclip
|
||||
# thumbnails forcefully, by reobtaining the original file and going through
|
||||
# the post-process again.
|
||||
def reprocess!
|
||||
new_original = Tempfile.new("paperclip-reprocess-#{instance.class.table_name}-#{instance.id}-")
|
||||
new_original = Tempfile.new([
|
||||
"paperclip-reprocess-#{instance.class.table_name}-#{instance.id}-",
|
||||
File.extname(instance_read(:file_name))
|
||||
])
|
||||
new_original.binmode
|
||||
old_original = to_file(:original) || raise("no original in store")
|
||||
# по идее копирование нужно не всегда
|
||||
|
||||
@@ -22,6 +22,7 @@ module Paperclip
|
||||
dst_shell = dst_file.path.shellescape
|
||||
cmd = case real_content_type
|
||||
when 'image/jpeg', 'image/jpg', 'image/pjpeg'
|
||||
# TODO: --stdout > #{dst_shell}
|
||||
"cp #{src_shell} #{dst_shell} && jpegoptim --all-progressive -q --strip-com --strip-exif --strip-iptc -- #{dst_shell}"
|
||||
when 'image/png', 'image/x-png'
|
||||
"pngcrush -rem alla -q #{src_shell} #{dst_shell}"
|
||||
|
||||
Reference in New Issue
Block a user