bteitelb-paperclip 2.3.1.15 → 2.3.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/paperclip/attachment.rb +11 -9
  2. metadata +3 -3
@@ -245,7 +245,7 @@ module Paperclip
245
245
  # in the paperclip:refresh rake task and that's it. It will regenerate all
246
246
  # thumbnails forcefully, by reobtaining the original file and going through
247
247
  # the post-process again.
248
- def reprocess!
248
+ def reprocess!(refresh_dimensions = false)
249
249
  new_original = Tempfile.new("paperclip-reprocess")
250
250
  new_original.binmode
251
251
  if old_original = to_file(:original)
@@ -254,15 +254,17 @@ module Paperclip
254
254
 
255
255
  @queued_for_write = { :original => new_original }
256
256
 
257
- begin
258
- geometry = Paperclip::Geometry.from_file(@queued_for_write[:original])
259
- instance_write(:width, geometry.width.to_i)
260
- instance_write(:height, geometry.height.to_i)
261
- instance.save
262
- rescue NotIdentifiedByImageMagickError => e
263
- log("Couldn't get dimensions for #{name}: #{e}")
257
+ if refresh_dimensions
258
+ begin
259
+ geometry = Paperclip::Geometry.from_file(@queued_for_write[:original])
260
+ instance_write(:width, geometry.width.to_i)
261
+ instance_write(:height, geometry.height.to_i)
262
+ instance.save
263
+ rescue NotIdentifiedByImageMagickError => e
264
+ log("Couldn't get dimensions for #{name}: #{e}")
265
+ end
264
266
  end
265
-
267
+
266
268
  post_process
267
269
 
268
270
  old_original.close if old_original.respond_to?(:close)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bteitelb-paperclip
3
3
  version: !ruby/object:Gem::Version
4
- hash: 109
4
+ hash: 83
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 3
9
9
  - 1
10
- - 15
11
- version: 2.3.1.15
10
+ - 16
11
+ version: 2.3.1.16
12
12
  platform: ruby
13
13
  authors:
14
14
  - Jon Yurek