Commit 4e9acd69 by Jon Yurek

Added reprocess! method. The rake task will actually reprocess the data it has…

Added reprocess! method. The rake task will actually reprocess the data it has now instead of ignoring it.
parent 7832694f
......@@ -153,6 +153,22 @@ module Paperclip
}
end
# This method really shouldn't be called that often. It's expected use is in the
# paperclip:refresh rake task and that's it. It will regenerate all thumbnails
# forcefully, by reobtaining the original file and going through the post-process
# again.
def reprocess!
new_original = Tempfile.new("paperclip-reprocess")
old_original = to_file(:original)
new_original.write( old_original.read )
new_original.rewind
@queued_for_write = { :original => new_original }
post_process
old_original.close if old_original.respond_to?(:close)
end
private
def valid_assignment? file #:nodoc:
......
......@@ -25,7 +25,7 @@ namespace :paperclip do
instances.each do |instance|
names.each do |name|
result = if instance.send("#{ name }?")
instance.send(name).send("post_process")
instance.send(name).reprocess!
instance.send(name).save
else
true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment