public
Description: Paperclip File Management Plugin
Homepage: http://www.thoughtbot.com/projects/paperclip
Clone URL: git://github.com/thoughtbot/paperclip.git
Search Repo:
Added reprocess! method. The rake task will actually reprocess the data it 
has now instead of ignoring it.
jyurek (author)
Tue May 13 10:23:48 -0700 2008
commit  4e9acd69ef832d42df7d921b00843182d8883fc4
tree    c32af3d05609a69ef028dfc370588db1aef915bd
parent  7832694f2c6dbe50567df805b4f6b9f71868a08c
...
153
154
155
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
157
158
...
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
0
@@ -153,6 +153,22 @@ module Paperclip
0
       }
0
     end
0
 
0
+ # This method really shouldn't be called that often. It's expected use is in the
0
+ # paperclip:refresh rake task and that's it. It will regenerate all thumbnails
0
+ # forcefully, by reobtaining the original file and going through the post-process
0
+ # again.
0
+ def reprocess!
0
+ new_original = Tempfile.new("paperclip-reprocess")
0
+ old_original = to_file(:original)
0
+ new_original.write( old_original.read )
0
+ new_original.rewind
0
+
0
+ @queued_for_write = { :original => new_original }
0
+ post_process
0
+
0
+ old_original.close if old_original.respond_to?(:close)
0
+ end
0
+
0
     private
0
 
0
     def valid_assignment? file #:nodoc:
...
25
26
27
28
 
29
30
31
...
25
26
27
 
28
29
30
31
0
@@ -25,7 +25,7 @@ namespace :paperclip do
0
     instances.each do |instance|
0
       names.each do |name|
0
         result = if instance.send("#{ name }?")
0
- instance.send(name).send("post_process")
0
+ instance.send(name).reprocess!
0
           instance.send(name).save
0
         else
0
           true

Comments

    No one has commented yet.