locomotive_carrierwave 0.5.0.1.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/README.rdoc +532 -0
  2. data/lib/carrierwave/compatibility/paperclip.rb +95 -0
  3. data/lib/carrierwave/locale/en.yml +5 -0
  4. data/lib/carrierwave/mount.rb +376 -0
  5. data/lib/carrierwave/orm/activerecord.rb +36 -0
  6. data/lib/carrierwave/orm/datamapper.rb +37 -0
  7. data/lib/carrierwave/orm/mongoid.rb +36 -0
  8. data/lib/carrierwave/orm/sequel.rb +45 -0
  9. data/lib/carrierwave/processing/image_science.rb +116 -0
  10. data/lib/carrierwave/processing/mini_magick.rb +261 -0
  11. data/lib/carrierwave/processing/rmagick.rb +278 -0
  12. data/lib/carrierwave/sanitized_file.rb +306 -0
  13. data/lib/carrierwave/storage/abstract.rb +33 -0
  14. data/lib/carrierwave/storage/cloud_files.rb +168 -0
  15. data/lib/carrierwave/storage/file.rb +54 -0
  16. data/lib/carrierwave/storage/grid_fs.rb +136 -0
  17. data/lib/carrierwave/storage/right_s3.rb +1 -0
  18. data/lib/carrierwave/storage/s3.rb +249 -0
  19. data/lib/carrierwave/test/matchers.rb +164 -0
  20. data/lib/carrierwave/uploader/cache.rb +148 -0
  21. data/lib/carrierwave/uploader/callbacks.rb +41 -0
  22. data/lib/carrierwave/uploader/configuration.rb +134 -0
  23. data/lib/carrierwave/uploader/default_url.rb +19 -0
  24. data/lib/carrierwave/uploader/download.rb +64 -0
  25. data/lib/carrierwave/uploader/extension_whitelist.rb +38 -0
  26. data/lib/carrierwave/uploader/mountable.rb +39 -0
  27. data/lib/carrierwave/uploader/processing.rb +85 -0
  28. data/lib/carrierwave/uploader/proxy.rb +62 -0
  29. data/lib/carrierwave/uploader/remove.rb +23 -0
  30. data/lib/carrierwave/uploader/rename.rb +62 -0
  31. data/lib/carrierwave/uploader/store.rb +98 -0
  32. data/lib/carrierwave/uploader/url.rb +33 -0
  33. data/lib/carrierwave/uploader/versions.rb +157 -0
  34. data/lib/carrierwave/uploader.rb +45 -0
  35. data/lib/carrierwave/validations/active_model.rb +79 -0
  36. data/lib/carrierwave/version.rb +3 -0
  37. data/lib/carrierwave.rb +101 -0
  38. data/lib/generators/templates/uploader.rb +47 -0
  39. data/lib/generators/uploader_generator.rb +7 -0
  40. metadata +390 -0
@@ -0,0 +1,376 @@
1
+ # encoding: utf-8
2
+
3
+ module CarrierWave
4
+
5
+ ##
6
+ # If a Class is extended with this module, it gains the mount_uploader
7
+ # method, which is used for mapping attributes to uploaders and allowing
8
+ # easy assignment.
9
+ #
10
+ # You can use mount_uploader with pretty much any class, however it is
11
+ # intended to be used with some kind of persistent storage, like an ORM.
12
+ # If you want to persist the uploaded files in a particular Class, it
13
+ # needs to implement a `read_uploader` and a `write_uploader` method.
14
+ #
15
+ module Mount
16
+
17
+ ##
18
+ # === Returns
19
+ #
20
+ # [Hash{Symbol => CarrierWave}] what uploaders are mounted on which columns
21
+ #
22
+ def uploaders
23
+ @uploaders ||= {}
24
+ @uploaders = superclass.uploaders.merge(@uploaders)
25
+ rescue NoMethodError
26
+ @uploaders
27
+ end
28
+
29
+ def uploader_options
30
+ @uploader_options ||= {}
31
+ @uploader_options = superclass.uploader_options.merge(@uploader_options)
32
+ rescue NoMethodError
33
+ @uploader_options
34
+ end
35
+
36
+ ##
37
+ # Return a particular option for a particular uploader
38
+ #
39
+ # === Parameters
40
+ #
41
+ # [column (Symbol)] The column the uploader is mounted at
42
+ # [option (Symbol)] The option, e.g. validate_integrity
43
+ #
44
+ # === Returns
45
+ #
46
+ # [Object] The option value
47
+ #
48
+ def uploader_option(column, option)
49
+ if uploader_options[column].has_key?(option)
50
+ uploader_options[column][option]
51
+ else
52
+ uploaders[column].send(option)
53
+ end
54
+ end
55
+
56
+ ##
57
+ # Mounts the given uploader on the given column. This means that assigning
58
+ # and reading from the column will upload and retrieve files. Supposing
59
+ # that a User class has an uploader mounted on image, you can assign and
60
+ # retrieve files like this:
61
+ #
62
+ # @user.image # => <Uploader>
63
+ # @user.image = some_file_object
64
+ #
65
+ # @user.store_image!
66
+ #
67
+ # @user.image.url # => '/some_url.png'
68
+ #
69
+ # It is also possible (but not recommended) to ommit the uploader, which
70
+ # will create an anonymous uploader class. Passing a block to this method
71
+ # makes it possible to customize it. This can be convenient for brevity,
72
+ # but if there is any significatnt logic in the uploader, you should do
73
+ # the right thing and have it in its own file.
74
+ #
75
+ # === Added instance methods
76
+ #
77
+ # Supposing a class has used +mount_uploader+ to mount an uploader on a column
78
+ # named +image+, in that case the following methods will be added to the class:
79
+ #
80
+ # [image] Returns an instance of the uploader only if anything has been uploaded
81
+ # [image=] Caches the given file
82
+ #
83
+ # [image_url] Returns the url to the uploaded file
84
+ #
85
+ # [image_cache] Returns a string that identifies the cache location of the file
86
+ # [image_cache=] Retrieves the file from the cache based on the given cache name
87
+ #
88
+ # [remote_image_url] Returns previously cached remote url
89
+ # [remote_image_url=] Retrieve the file from the remote url
90
+ #
91
+ # [remove_image] An attribute reader that can be used with a checkbox to mark a file for removal
92
+ # [remove_image=] An attribute writer that can be used with a checkbox to mark a file for removal
93
+ # [remove_image?] Whether the file should be removed when store_image! is called.
94
+ #
95
+ # [store_image!] Stores a file that has been assigned with +image=+
96
+ # [remove_image!] Removes the uploaded file from the filesystem.
97
+ #
98
+ # [image_integrity_error] Returns an error object if the last file to be assigned caused an integrity error
99
+ # [image_processing_error] Returns an error object if the last file to be assigned caused a processing error
100
+ #
101
+ # [write_image_identifier] Uses the write_uploader method to set the identifier.
102
+ #
103
+ # === Parameters
104
+ #
105
+ # [column (Symbol)] the attribute to mount this uploader on
106
+ # [uploader (CarrierWave::Uploader)] the uploader class to mount
107
+ # [options (Hash{Symbol => Object})] a set of options
108
+ # [&block (Proc)] customize anonymous uploaders
109
+ #
110
+ # === Options
111
+ #
112
+ # [:mount_on => Symbol] if the name of the column to be serialized to differs you can override it using this option
113
+ # [:ignore_integrity_errors => Boolean] if set to true, integrity errors will result in caching failing silently
114
+ # [:ignore_processing_errors => Boolean] if set to true, processing errors will result in caching failing silently
115
+ #
116
+ # === Examples
117
+ #
118
+ # Mounting uploaders on different columns.
119
+ #
120
+ # class Song
121
+ # mount_uploader :lyrics, LyricsUploader
122
+ # mount_uploader :alternative_lyrics, LyricsUploader
123
+ # mount_uploader :file, SongUploader
124
+ # end
125
+ #
126
+ # This will add an anonymous uploader with only the default settings:
127
+ #
128
+ # class Data
129
+ # mount_uploader :csv
130
+ # end
131
+ #
132
+ # this will add an anonymous uploader overriding the store_dir:
133
+ #
134
+ # class Product
135
+ # mount_uploader :blueprint do
136
+ # def store_dir
137
+ # 'blueprints'
138
+ # end
139
+ # end
140
+ # end
141
+ #
142
+ def mount_uploader(column, uploader=nil, options={}, &block)
143
+ unless uploader
144
+ uploader = Class.new(CarrierWave::Uploader::Base)
145
+ uploader.class_eval(&block)
146
+ end
147
+
148
+ uploaders[column.to_sym] = uploader
149
+ uploader_options[column.to_sym] = options
150
+
151
+ include CarrierWave::Mount::Extension
152
+
153
+ # Make sure to write over accessors directly defined on the class.
154
+ # Simply super to the included module below.
155
+ class_eval <<-RUBY, __FILE__, __LINE__+1
156
+ def #{column}; super; end
157
+ def #{column}=(new_file); super; end
158
+ RUBY
159
+
160
+ # Mixing this in as a Module instead of class_evaling directly, so we
161
+ # can maintain the ability to super to any of these methods from within
162
+ # the class.
163
+ mod = Module.new
164
+ include mod
165
+ mod.class_eval <<-RUBY, __FILE__, __LINE__+1
166
+
167
+ def #{column}
168
+ _mounter(:#{column}).uploader
169
+ end
170
+
171
+ def #{column}=(new_file)
172
+ _mounter(:#{column}).cache(new_file)
173
+ end
174
+
175
+ def #{column}?
176
+ !_mounter(:#{column}).blank?
177
+ end
178
+
179
+ def #{column}_url(*args)
180
+ _mounter(:#{column}).url(*args)
181
+ end
182
+
183
+ def #{column}_cache
184
+ _mounter(:#{column}).cache_name
185
+ end
186
+
187
+ def #{column}_cache=(cache_name)
188
+ _mounter(:#{column}).cache_name = cache_name
189
+ end
190
+
191
+ def remote_#{column}_url
192
+ _mounter(:#{column}).remote_url
193
+ end
194
+
195
+ def remote_#{column}_url=(url)
196
+ _mounter(:#{column}).remote_url = url
197
+ end
198
+
199
+ def remove_#{column}
200
+ _mounter(:#{column}).remove
201
+ end
202
+
203
+ def remove_#{column}!
204
+ _mounter(:#{column}).remove!
205
+ end
206
+
207
+ def remove_#{column}=(value)
208
+ _mounter(:#{column}).remove = value
209
+ end
210
+
211
+ def remove_#{column}?
212
+ _mounter(:#{column}).remove?
213
+ end
214
+
215
+ def store_#{column}!
216
+ _mounter(:#{column}).store!
217
+ end
218
+
219
+ def #{column}_integrity_error
220
+ _mounter(:#{column}).integrity_error
221
+ end
222
+
223
+ def #{column}_processing_error
224
+ _mounter(:#{column}).processing_error
225
+ end
226
+
227
+ def write_#{column}_identifier
228
+ _mounter(:#{column}).write_identifier
229
+ end
230
+
231
+ def check_stale_#{column}!
232
+ _mounter(:#{column}).check_stale_record!
233
+ end
234
+
235
+ def rename_#{column}!
236
+ _mounter(:#{column}).rename!
237
+ end
238
+
239
+ RUBY
240
+
241
+ end
242
+
243
+ module Extension
244
+
245
+ ##
246
+ # overwrite this to read from a serialized attribute
247
+ #
248
+ def read_uploader(column); end
249
+
250
+ ##
251
+ # overwrite this to write to a serialized attribute
252
+ #
253
+ def write_uploader(column, identifier); end
254
+
255
+ private
256
+
257
+ def _mounter(column)
258
+ # We cannot memoize in frozen objects :(
259
+ return Mounter.new(self, column) if frozen?
260
+ @_mounters ||= {}
261
+ @_mounters[column] ||= Mounter.new(self, column)
262
+ end
263
+
264
+ end # Extension
265
+
266
+ # this is an internal class, used by CarrierWave::Mount so that
267
+ # we don't pollute the model with a lot of methods.
268
+ class Mounter #:nodoc:
269
+
270
+ attr_reader :column, :record, :remote_url, :integrity_error, :processing_error
271
+ attr_accessor :remove
272
+
273
+ def initialize(record, column, options={})
274
+ @record = record
275
+ @column = column
276
+ @options = record.class.uploader_options[column]
277
+ end
278
+
279
+ def write_identifier
280
+ if remove?
281
+ record.write_uploader(serialization_column, '')
282
+ elsif not uploader.identifier.blank?
283
+ record.write_uploader(serialization_column, uploader.identifier)
284
+ end
285
+ end
286
+
287
+ def identifier
288
+ record.read_uploader(serialization_column)
289
+ end
290
+
291
+ def uploader
292
+ @uploader ||= record.class.uploaders[column].new(record, column)
293
+
294
+ if @uploader.blank? and not identifier.blank?
295
+ @uploader.retrieve_from_store!(identifier)
296
+ end
297
+ return @uploader
298
+ end
299
+
300
+ def cache(new_file)
301
+ uploader.cache!(new_file)
302
+ @integrity_error = nil
303
+ @processing_error = nil
304
+ rescue CarrierWave::IntegrityError => e
305
+ @integrity_error = e
306
+ raise e unless option(:ignore_integrity_errors)
307
+ rescue CarrierWave::ProcessingError => e
308
+ @processing_error = e
309
+ raise e unless option(:ignore_processing_errors)
310
+ end
311
+
312
+ def cache_name
313
+ uploader.cache_name
314
+ end
315
+
316
+ def cache_name=(cache_name)
317
+ uploader.retrieve_from_cache!(cache_name) unless uploader.cached?
318
+ rescue CarrierWave::InvalidParameter
319
+ end
320
+
321
+ def remote_url=(url)
322
+ unless uploader.cached?
323
+ @remote_url = url
324
+ uploader.download!(url)
325
+ end
326
+ end
327
+
328
+ def store!
329
+ unless uploader.blank?
330
+ if remove?
331
+ uploader.remove!
332
+ else
333
+ uploader.store!
334
+ end
335
+ end
336
+ end
337
+
338
+ def url(*args)
339
+ uploader.url(*args)
340
+ end
341
+
342
+ def blank?
343
+ uploader.blank?
344
+ end
345
+
346
+ def remove?
347
+ !remove.blank? and remove !~ /\A0|false$\z/
348
+ end
349
+
350
+ def remove!
351
+ uploader.remove!
352
+ end
353
+
354
+ def rename!
355
+ uploader.rename!
356
+ end
357
+
358
+ def check_stale_record!
359
+ uploader.send(:check_stale_model!)
360
+ true
361
+ end
362
+
363
+ private
364
+
365
+ def option(name)
366
+ record.class.uploader_option(column, name)
367
+ end
368
+
369
+ def serialization_column
370
+ option(:mount_on) || column
371
+ end
372
+
373
+ end # Mounter
374
+
375
+ end # Mount
376
+ end # CarrierWave
@@ -0,0 +1,36 @@
1
+ # encoding: utf-8
2
+
3
+ require 'active_record'
4
+ require 'carrierwave/validations/active_model'
5
+
6
+ module CarrierWave
7
+ module ActiveRecord
8
+
9
+ include CarrierWave::Mount
10
+
11
+ ##
12
+ # See +CarrierWave::Mount#mount_uploader+ for documentation
13
+ #
14
+ def mount_uploader(column, uploader, options={}, &block)
15
+ super
16
+
17
+ alias_method :read_uploader, :read_attribute
18
+ alias_method :write_uploader, :write_attribute
19
+ public :read_uploader
20
+ public :write_uploader
21
+
22
+ include CarrierWave::Validations::ActiveModel
23
+
24
+ validates_integrity_of column if uploader_option(column.to_sym, :validate_integrity)
25
+ validates_processing_of column if uploader_option(column.to_sym, :validate_processing)
26
+
27
+ after_save "store_#{column}!"
28
+ before_save "write_#{column}_identifier"
29
+ after_destroy "remove_#{column}!"
30
+
31
+ end
32
+
33
+ end # ActiveRecord
34
+ end # CarrierWave
35
+
36
+ ActiveRecord::Base.extend CarrierWave::ActiveRecord
@@ -0,0 +1,37 @@
1
+ # encoding: utf-8
2
+
3
+ require 'dm-core'
4
+
5
+ module CarrierWave
6
+ module DataMapper
7
+
8
+ include CarrierWave::Mount
9
+
10
+ ##
11
+ # See +CarrierWave::Mount#mount_uploader+ for documentation
12
+ #
13
+ def mount_uploader(column, uploader, options={}, &block)
14
+ super
15
+
16
+ alias_method :read_uploader, :attribute_get
17
+ alias_method :write_uploader, :attribute_set
18
+ after :save, "store_#{column}!".to_sym
19
+ pre_hook = ::DataMapper.const_defined?(:Validate) ? :valid? : :save
20
+ before pre_hook, "write_#{column}_identifier".to_sym
21
+ after :destroy, "remove_#{column}!".to_sym
22
+
23
+ # FIXME: Hack to work around Datamapper not triggering callbacks
24
+ # for objects that are not dirty. By explicitly calling
25
+ # attribute_set we are marking the record as dirty.
26
+ class_eval <<-RUBY
27
+ def remove_image=(value)
28
+ _mounter(:#{column}).remove = value
29
+ attribute_set(:#{column}, '') if _mounter(:#{column}).remove?
30
+ end
31
+ RUBY
32
+ end
33
+
34
+ end # DataMapper
35
+ end # CarrierWave
36
+
37
+ DataMapper::Model.send(:include, CarrierWave::DataMapper)
@@ -0,0 +1,36 @@
1
+ # encoding: utf-8
2
+
3
+ require 'mongoid'
4
+ require 'carrierwave/validations/active_model'
5
+
6
+ module CarrierWave
7
+ module Mongoid
8
+ include CarrierWave::Mount
9
+
10
+ ##
11
+ # See +CarrierWave::Mount#mount_uploader+ for documentation
12
+ #
13
+ def mount_uploader(column, uploader, options={}, &block)
14
+ options[:mount_on] ||= "#{column}_filename"
15
+ field options[:mount_on]
16
+
17
+ super
18
+
19
+ alias_method :read_uploader, :read_attribute
20
+ alias_method :write_uploader, :write_attribute
21
+
22
+ include CarrierWave::Validations::ActiveModel
23
+
24
+ validates_integrity_of column if uploader_option(column.to_sym, :validate_integrity)
25
+ validates_processing_of column if uploader_option(column.to_sym, :validate_processing)
26
+
27
+ before_save "check_stale_#{column}!".to_sym
28
+ after_save "rename_#{column}!".to_sym
29
+ after_save "store_#{column}!".to_sym
30
+ before_save "write_#{column}_identifier".to_sym
31
+ after_destroy "remove_#{column}!".to_sym
32
+ end
33
+ end # Mongoid
34
+ end # CarrierWave
35
+
36
+ Mongoid::Document::ClassMethods.send(:include, CarrierWave::Mongoid)
@@ -0,0 +1,45 @@
1
+ # encoding: utf-8
2
+
3
+ require 'sequel'
4
+
5
+ module CarrierWave
6
+ module Sequel
7
+ include CarrierWave::Mount
8
+
9
+ def mount_uploader(column, uploader)
10
+ raise "You need to use Sequel 3.0 or higher. Please upgrade." unless ::Sequel::Model.respond_to?(:plugin)
11
+ super
12
+
13
+ alias_method :read_uploader, :[]
14
+ alias_method :write_uploader, :[]=
15
+
16
+ include CarrierWave::Sequel::Hooks
17
+ include CarrierWave::Sequel::Validations
18
+ end
19
+
20
+ end # Sequel
21
+ end # CarrierWave
22
+
23
+ # Instance hook methods for the Sequel 3.x
24
+ module CarrierWave::Sequel::Hooks
25
+ def after_save
26
+ return false if super == false
27
+ self.class.uploaders.each_key {|column| self.send("store_#{column}!") }
28
+ end
29
+
30
+ def before_save
31
+ return false if super == false
32
+ self.class.uploaders.each_key {|column| self.send("write_#{column}_identifier") }
33
+ end
34
+
35
+ def before_destroy
36
+ return false if super == false
37
+ self.class.uploaders.each_key {|column| self.send("remove_#{column}!") }
38
+ end
39
+ end
40
+
41
+ # Instance validation methods for the Sequel 3.x
42
+ module CarrierWave::Sequel::Validations
43
+ end
44
+
45
+ Sequel::Model.send(:extend, CarrierWave::Sequel)
@@ -0,0 +1,116 @@
1
+ # encoding: utf-8
2
+
3
+ require "image_science"
4
+
5
+ module CarrierWave
6
+ module ImageScience
7
+ extend ActiveSupport::Concern
8
+
9
+ module ClassMethods
10
+ def resize_to_limit(width, height)
11
+ process :resize_to_limit => [width, height]
12
+ end
13
+
14
+ def resize_to_fit(width, height)
15
+ process :resize_to_fit => [width, height]
16
+ end
17
+
18
+ def resize_to_fill(width, height)
19
+ process :resize_to_fill => [width, height]
20
+ end
21
+ end
22
+
23
+ ##
24
+ # Resize the image to fit within the specified dimensions while retaining
25
+ # the original aspect ratio. The image may be shorter or narrower than
26
+ # specified in the smaller dimension but will not be larger than the
27
+ # specified values.
28
+ #
29
+ # See even http://www.imagemagick.org/RMagick/doc/image3.html#resize_to_fit
30
+ #
31
+ # === Parameters
32
+ #
33
+ # [width (Integer)] the width to scale the image to
34
+ # [height (Integer)] the height to scale the image to
35
+ #
36
+ def resize_to_fit(new_width, new_height)
37
+ ::ImageScience.with_image(self.current_path) do |img|
38
+ width, height = extract_dimensions(img.width, img.height, new_width, new_height)
39
+ img.resize( width, height ) do |file|
40
+ file.save( self.current_path )
41
+ end
42
+ end
43
+ end
44
+
45
+ ##
46
+ # Resize the image to fit within the specified dimensions while retaining
47
+ # the aspect ratio of the original image. If necessary, crop the image in
48
+ # the larger dimension.
49
+ #
50
+ # See even http://www.imagemagick.org/RMagick/doc/image3.html#resize_to_fill
51
+ #
52
+ # === Parameters
53
+ #
54
+ # [width (Integer)] the width to scale the image to
55
+ # [height (Integer)] the height to scale the image to
56
+ #
57
+ def resize_to_fill(new_width, new_height)
58
+ ::ImageScience.with_image(self.current_path) do |img|
59
+ width, height = extract_dimensions_for_crop(img.width, img.height, new_width, new_height)
60
+ x_offset, y_offset = extract_placement_for_crop(width, height, new_width, new_height)
61
+
62
+ img.resize( width, height ) do |i2|
63
+
64
+ i2.with_crop( x_offset, y_offset, new_width + x_offset, new_height + y_offset) do |file|
65
+ file.save( self.current_path )
66
+ end
67
+ end
68
+ end
69
+ end
70
+
71
+ ##
72
+ # Resize the image to fit within the specified dimensions while retaining
73
+ # the original aspect ratio. Will only resize the image if it is larger than the
74
+ # specified dimensions. The resulting image may be shorter or narrower than specified
75
+ # in the smaller dimension but will not be larger than the specified values.
76
+ #
77
+ # === Parameters
78
+ #
79
+ # [width (Integer)] the width to scale the image to
80
+ # [height (Integer)] the height to scale the image to
81
+ #
82
+ def resize_to_limit(new_width, new_height)
83
+ ::ImageScience.with_image(self.current_path) do |img|
84
+ if img.width > new_width or img.height > new_height
85
+ resize_to_fit(new_width, new_height)
86
+ end
87
+ end
88
+ end
89
+
90
+ private
91
+
92
+ def extract_dimensions(width, height, new_width, new_height, type = :resize)
93
+ aspect_ratio = width.to_f / height.to_f
94
+ new_aspect_ratio = new_width / new_height
95
+
96
+ if (new_aspect_ratio > aspect_ratio) ^ ( type == :crop ) # Image is too wide, the caret is the XOR operator
97
+ new_width, new_height = [ (new_height * aspect_ratio), new_height]
98
+ else #Image is too narrow
99
+ new_width, new_height = [ new_width, (new_width / aspect_ratio)]
100
+ end
101
+
102
+ [new_width, new_height].collect! { |v| v.round }
103
+ end
104
+
105
+ def extract_dimensions_for_crop(width, height, new_width, new_height)
106
+ extract_dimensions(width, height, new_width, new_height, :crop)
107
+ end
108
+
109
+ def extract_placement_for_crop(width, height, new_width, new_height)
110
+ x_offset = (width / 2.0) - (new_width / 2.0)
111
+ y_offset = (height / 2.0) - (new_height / 2.0)
112
+ [x_offset, y_offset].collect! { |v| v.round }
113
+ end
114
+
115
+ end # ImageScience
116
+ end # CarrierWave