mini-smart-pkg 0.0.1
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.
- checksums.yaml +7 -0
- data/carrierwave-3.1.3/README.md +1214 -0
- data/carrierwave-3.1.3/lib/carrierwave/compatibility/paperclip.rb +105 -0
- data/carrierwave-3.1.3/lib/carrierwave/downloader/base.rb +101 -0
- data/carrierwave-3.1.3/lib/carrierwave/downloader/remote_file.rb +68 -0
- data/carrierwave-3.1.3/lib/carrierwave/error.rb +8 -0
- data/carrierwave-3.1.3/lib/carrierwave/locale/en.yml +17 -0
- data/carrierwave-3.1.3/lib/carrierwave/mount.rb +446 -0
- data/carrierwave-3.1.3/lib/carrierwave/mounter.rb +257 -0
- data/carrierwave-3.1.3/lib/carrierwave/orm/activerecord.rb +68 -0
- data/carrierwave-3.1.3/lib/carrierwave/processing/mini_magick.rb +362 -0
- data/carrierwave-3.1.3/lib/carrierwave/processing/rmagick.rb +433 -0
- data/carrierwave-3.1.3/lib/carrierwave/processing/vips.rb +315 -0
- data/carrierwave-3.1.3/lib/carrierwave/processing.rb +3 -0
- data/carrierwave-3.1.3/lib/carrierwave/sanitized_file.rb +361 -0
- data/carrierwave-3.1.3/lib/carrierwave/storage/abstract.rb +43 -0
- data/carrierwave-3.1.3/lib/carrierwave/storage/file.rb +124 -0
- data/carrierwave-3.1.3/lib/carrierwave/storage/fog.rb +560 -0
- data/carrierwave-3.1.3/lib/carrierwave/storage.rb +3 -0
- data/carrierwave-3.1.3/lib/carrierwave/test/matchers.rb +398 -0
- data/carrierwave-3.1.3/lib/carrierwave/uploader/cache.rb +223 -0
- data/carrierwave-3.1.3/lib/carrierwave/uploader/callbacks.rb +33 -0
- data/carrierwave-3.1.3/lib/carrierwave/uploader/configuration.rb +229 -0
- data/carrierwave-3.1.3/lib/carrierwave/uploader/content_type_allowlist.rb +62 -0
- data/carrierwave-3.1.3/lib/carrierwave/uploader/content_type_denylist.rb +65 -0
- data/carrierwave-3.1.3/lib/carrierwave/uploader/default_url.rb +17 -0
- data/carrierwave-3.1.3/lib/carrierwave/uploader/dimension.rb +66 -0
- data/carrierwave-3.1.3/lib/carrierwave/uploader/download.rb +24 -0
- data/carrierwave-3.1.3/lib/carrierwave/uploader/extension_allowlist.rb +63 -0
- data/carrierwave-3.1.3/lib/carrierwave/uploader/extension_denylist.rb +64 -0
- data/carrierwave-3.1.3/lib/carrierwave/uploader/file_size.rb +43 -0
- data/carrierwave-3.1.3/lib/carrierwave/uploader/mountable.rb +44 -0
- data/carrierwave-3.1.3/lib/carrierwave/uploader/processing.rb +128 -0
- data/carrierwave-3.1.3/lib/carrierwave/uploader/proxy.rb +99 -0
- data/carrierwave-3.1.3/lib/carrierwave/uploader/remove.rb +21 -0
- data/carrierwave-3.1.3/lib/carrierwave/uploader/serialization.rb +28 -0
- data/carrierwave-3.1.3/lib/carrierwave/uploader/store.rb +168 -0
- data/carrierwave-3.1.3/lib/carrierwave/uploader/url.rb +44 -0
- data/carrierwave-3.1.3/lib/carrierwave/uploader/versions.rb +352 -0
- data/carrierwave-3.1.3/lib/carrierwave/uploader.rb +69 -0
- data/carrierwave-3.1.3/lib/carrierwave/utilities/file_name.rb +47 -0
- data/carrierwave-3.1.3/lib/carrierwave/utilities/uri.rb +26 -0
- data/carrierwave-3.1.3/lib/carrierwave/utilities.rb +7 -0
- data/carrierwave-3.1.3/lib/carrierwave/validations/active_model.rb +76 -0
- data/carrierwave-3.1.3/lib/carrierwave/version.rb +3 -0
- data/carrierwave-3.1.3/lib/carrierwave.rb +108 -0
- data/carrierwave-3.1.3/lib/generators/templates/uploader.rb.erb +56 -0
- data/carrierwave-3.1.3/lib/generators/uploader_generator.rb +7 -0
- data/mini-smart-pkg.gemspec +12 -0
- metadata +89 -0
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
module CarrierWave
|
|
2
|
+
|
|
3
|
+
##
|
|
4
|
+
# This module simplifies manipulation with RMagick by providing a set
|
|
5
|
+
# of convenient helper methods. If you want to use them, you'll need to
|
|
6
|
+
# require this file:
|
|
7
|
+
#
|
|
8
|
+
# require 'carrierwave/processing/rmagick'
|
|
9
|
+
#
|
|
10
|
+
# And then include it in your uploader:
|
|
11
|
+
#
|
|
12
|
+
# class MyUploader < CarrierWave::Uploader::Base
|
|
13
|
+
# include CarrierWave::RMagick
|
|
14
|
+
# end
|
|
15
|
+
#
|
|
16
|
+
# You can now use the provided helpers:
|
|
17
|
+
#
|
|
18
|
+
# class MyUploader < CarrierWave::Uploader::Base
|
|
19
|
+
# include CarrierWave::RMagick
|
|
20
|
+
#
|
|
21
|
+
# process :resize_to_fit => [200, 200]
|
|
22
|
+
# end
|
|
23
|
+
#
|
|
24
|
+
# Or create your own helpers with the powerful manipulate! method. Check
|
|
25
|
+
# out the RMagick docs at https://rmagick.github.io/ for more
|
|
26
|
+
# info
|
|
27
|
+
#
|
|
28
|
+
# class MyUploader < CarrierWave::Uploader::Base
|
|
29
|
+
# include CarrierWave::RMagick
|
|
30
|
+
#
|
|
31
|
+
# process :do_stuff => 10.0
|
|
32
|
+
#
|
|
33
|
+
# def do_stuff(blur_factor)
|
|
34
|
+
# manipulate! do |img|
|
|
35
|
+
# img = img.sepiatone
|
|
36
|
+
# img = img.auto_orient
|
|
37
|
+
# img = img.radial_blur(blur_factor)
|
|
38
|
+
# end
|
|
39
|
+
# end
|
|
40
|
+
# end
|
|
41
|
+
#
|
|
42
|
+
# === Note
|
|
43
|
+
#
|
|
44
|
+
# You should be aware how RMagick handles memory. manipulate! takes care
|
|
45
|
+
# of freeing up memory for you, but for optimum memory usage you should
|
|
46
|
+
# use destructive operations as much as possible:
|
|
47
|
+
#
|
|
48
|
+
# DON'T DO THIS:
|
|
49
|
+
# img = img.resize_to_fit
|
|
50
|
+
#
|
|
51
|
+
# DO THIS INSTEAD:
|
|
52
|
+
# img.resize_to_fit!
|
|
53
|
+
#
|
|
54
|
+
# Read this for more information why:
|
|
55
|
+
#
|
|
56
|
+
# http://rubyforge.org/forum/forum.php?thread_id=1374&forum_id=1618
|
|
57
|
+
#
|
|
58
|
+
module RMagick
|
|
59
|
+
extend ActiveSupport::Concern
|
|
60
|
+
|
|
61
|
+
included do
|
|
62
|
+
begin
|
|
63
|
+
require "rmagick"
|
|
64
|
+
rescue LoadError
|
|
65
|
+
begin
|
|
66
|
+
require "RMagick"
|
|
67
|
+
rescue LoadError => e
|
|
68
|
+
e.message << " (You may need to install the rmagick gem)"
|
|
69
|
+
raise e
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
prepend Module.new {
|
|
74
|
+
def initialize(*)
|
|
75
|
+
super
|
|
76
|
+
@format = nil
|
|
77
|
+
end
|
|
78
|
+
}
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
module ClassMethods
|
|
82
|
+
def convert(format)
|
|
83
|
+
process :convert => format
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def resize_to_limit(width, height)
|
|
87
|
+
process :resize_to_limit => [width, height]
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def resize_to_fit(width, height)
|
|
91
|
+
process :resize_to_fit => [width, height]
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def resize_to_fill(width, height, gravity=::Magick::CenterGravity)
|
|
95
|
+
process :resize_to_fill => [width, height, gravity]
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def resize_and_pad(width, height, background=:transparent, gravity=::Magick::CenterGravity)
|
|
99
|
+
process :resize_and_pad => [width, height, background, gravity]
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def resize_to_geometry_string(geometry_string)
|
|
103
|
+
process :resize_to_geometry_string => [geometry_string]
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def crop(left, top, width, height)
|
|
107
|
+
process :crop => [left, top, width, height]
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
##
|
|
112
|
+
# Changes the image encoding format to the given format
|
|
113
|
+
#
|
|
114
|
+
# See even https://rmagick.github.io/magick.html#formats
|
|
115
|
+
#
|
|
116
|
+
# === Parameters
|
|
117
|
+
#
|
|
118
|
+
# [format (#to_s)] an abbreviation of the format
|
|
119
|
+
#
|
|
120
|
+
# === Yields
|
|
121
|
+
#
|
|
122
|
+
# [Magick::Image] additional manipulations to perform
|
|
123
|
+
#
|
|
124
|
+
# === Examples
|
|
125
|
+
#
|
|
126
|
+
# image.convert(:png)
|
|
127
|
+
#
|
|
128
|
+
def convert(format)
|
|
129
|
+
manipulate!(:format => format)
|
|
130
|
+
@format = format
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
##
|
|
134
|
+
# Resize the image to fit within the specified dimensions while retaining
|
|
135
|
+
# the original aspect ratio. Will only resize the image if it is larger than the
|
|
136
|
+
# specified dimensions. The resulting image may be shorter or narrower than specified
|
|
137
|
+
# in the smaller dimension but will not be larger than the specified values.
|
|
138
|
+
#
|
|
139
|
+
# === Parameters
|
|
140
|
+
#
|
|
141
|
+
# [width (Integer)] the width to scale the image to
|
|
142
|
+
# [height (Integer)] the height to scale the image to
|
|
143
|
+
#
|
|
144
|
+
# === Yields
|
|
145
|
+
#
|
|
146
|
+
# [Magick::Image] additional manipulations to perform
|
|
147
|
+
#
|
|
148
|
+
def resize_to_limit(width, height)
|
|
149
|
+
width = dimension_from width
|
|
150
|
+
height = dimension_from height
|
|
151
|
+
manipulate! do |img|
|
|
152
|
+
geometry = Magick::Geometry.new(width, height, 0, 0, Magick::GreaterGeometry)
|
|
153
|
+
new_img = img.change_geometry(geometry) do |new_width, new_height|
|
|
154
|
+
img.resize(new_width, new_height)
|
|
155
|
+
end
|
|
156
|
+
destroy_image(img)
|
|
157
|
+
new_img = yield(new_img) if block_given?
|
|
158
|
+
new_img
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
##
|
|
163
|
+
# From the RMagick documentation: "Resize the image to fit within the
|
|
164
|
+
# specified dimensions while retaining the original aspect ratio. The
|
|
165
|
+
# image may be shorter or narrower than specified in the smaller dimension
|
|
166
|
+
# but will not be larger than the specified values."
|
|
167
|
+
#
|
|
168
|
+
# See even https://rmagick.github.io/image3.html#resize_to_fit
|
|
169
|
+
#
|
|
170
|
+
# === Parameters
|
|
171
|
+
#
|
|
172
|
+
# [width (Integer)] the width to scale the image to
|
|
173
|
+
# [height (Integer)] the height to scale the image to
|
|
174
|
+
#
|
|
175
|
+
# === Yields
|
|
176
|
+
#
|
|
177
|
+
# [Magick::Image] additional manipulations to perform
|
|
178
|
+
#
|
|
179
|
+
def resize_to_fit(width, height)
|
|
180
|
+
width = dimension_from width
|
|
181
|
+
height = dimension_from height
|
|
182
|
+
manipulate! do |img|
|
|
183
|
+
img.resize_to_fit!(width, height)
|
|
184
|
+
img = yield(img) if block_given?
|
|
185
|
+
img
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
##
|
|
190
|
+
# From the RMagick documentation: "Resize the image to fit within the
|
|
191
|
+
# specified dimensions while retaining the aspect ratio of the original
|
|
192
|
+
# image. If necessary, crop the image in the larger dimension."
|
|
193
|
+
#
|
|
194
|
+
# See even https://rmagick.github.io/image3.html#resize_to_fill
|
|
195
|
+
#
|
|
196
|
+
# === Parameters
|
|
197
|
+
#
|
|
198
|
+
# [width (Integer)] the width to scale the image to
|
|
199
|
+
# [height (Integer)] the height to scale the image to
|
|
200
|
+
#
|
|
201
|
+
# === Yields
|
|
202
|
+
#
|
|
203
|
+
# [Magick::Image] additional manipulations to perform
|
|
204
|
+
#
|
|
205
|
+
def resize_to_fill(width, height, gravity=::Magick::CenterGravity)
|
|
206
|
+
width = dimension_from width
|
|
207
|
+
height = dimension_from height
|
|
208
|
+
manipulate! do |img|
|
|
209
|
+
img.crop_resized!(width, height, gravity)
|
|
210
|
+
img = yield(img) if block_given?
|
|
211
|
+
img
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
##
|
|
216
|
+
# Resize the image to fit within the specified dimensions while retaining
|
|
217
|
+
# the original aspect ratio. If necessary, will pad the remaining area
|
|
218
|
+
# with the given color, which defaults to transparent (for gif and png,
|
|
219
|
+
# white for jpeg).
|
|
220
|
+
#
|
|
221
|
+
# === Parameters
|
|
222
|
+
#
|
|
223
|
+
# [width (Integer)] the width to scale the image to
|
|
224
|
+
# [height (Integer)] the height to scale the image to
|
|
225
|
+
# [background (String, :transparent)] the color of the background as a hexcode, like "#ff45de"
|
|
226
|
+
# [gravity (Magick::GravityType)] how to position the image
|
|
227
|
+
#
|
|
228
|
+
# === Yields
|
|
229
|
+
#
|
|
230
|
+
# [Magick::Image] additional manipulations to perform
|
|
231
|
+
#
|
|
232
|
+
def resize_and_pad(width, height, background=:transparent, gravity=::Magick::CenterGravity)
|
|
233
|
+
width = dimension_from width
|
|
234
|
+
height = dimension_from height
|
|
235
|
+
manipulate! do |img|
|
|
236
|
+
img.resize_to_fit!(width, height)
|
|
237
|
+
filled = ::Magick::Image.new(width, height) { |image| image.background_color = background == :transparent ? 'rgba(255,255,255,0)' : background.to_s }
|
|
238
|
+
filled.composite!(img, gravity, ::Magick::OverCompositeOp)
|
|
239
|
+
destroy_image(img)
|
|
240
|
+
filled = yield(filled) if block_given?
|
|
241
|
+
filled
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
##
|
|
246
|
+
# Resize the image per the provided geometry string.
|
|
247
|
+
#
|
|
248
|
+
# === Parameters
|
|
249
|
+
#
|
|
250
|
+
# [geometry_string (String)] the proportions in which to scale image
|
|
251
|
+
#
|
|
252
|
+
# === Yields
|
|
253
|
+
#
|
|
254
|
+
# [Magick::Image] additional manipulations to perform
|
|
255
|
+
#
|
|
256
|
+
def resize_to_geometry_string(geometry_string)
|
|
257
|
+
manipulate! do |img|
|
|
258
|
+
new_img = img.change_geometry(geometry_string) do |new_width, new_height|
|
|
259
|
+
img.resize(new_width, new_height)
|
|
260
|
+
end
|
|
261
|
+
destroy_image(img)
|
|
262
|
+
new_img = yield(new_img) if block_given?
|
|
263
|
+
new_img
|
|
264
|
+
end
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
##
|
|
268
|
+
# Crop the image to the contents of a box positioned at [left] and [top], with the dimensions given
|
|
269
|
+
# by [width] and [height]. The original image bottom/right edge is preserved if the cropping box falls
|
|
270
|
+
# outside the image bounds.
|
|
271
|
+
#
|
|
272
|
+
# === Parameters
|
|
273
|
+
#
|
|
274
|
+
# [left (integer)] left edge of area to extract
|
|
275
|
+
# [top (integer)] top edge of area to extract
|
|
276
|
+
# [width (Integer)] width of area to extract
|
|
277
|
+
# [height (Integer)] height of area to extract
|
|
278
|
+
#
|
|
279
|
+
# === Yields
|
|
280
|
+
#
|
|
281
|
+
# [Magick::Image] additional manipulations to perform
|
|
282
|
+
#
|
|
283
|
+
def crop(left, top, width, height, combine_options: {})
|
|
284
|
+
width = dimension_from width
|
|
285
|
+
height = dimension_from height
|
|
286
|
+
|
|
287
|
+
manipulate! do |img|
|
|
288
|
+
img.crop!(left, top, width, height)
|
|
289
|
+
img = yield(img) if block_given?
|
|
290
|
+
img
|
|
291
|
+
end
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
##
|
|
295
|
+
# Returns the width of the image.
|
|
296
|
+
#
|
|
297
|
+
# === Returns
|
|
298
|
+
#
|
|
299
|
+
# [Integer] the image's width in pixels
|
|
300
|
+
#
|
|
301
|
+
def width
|
|
302
|
+
rmagick_image.columns
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
##
|
|
306
|
+
# Returns the height of the image.
|
|
307
|
+
#
|
|
308
|
+
# === Returns
|
|
309
|
+
#
|
|
310
|
+
# [Integer] the image's height in pixels
|
|
311
|
+
#
|
|
312
|
+
def height
|
|
313
|
+
rmagick_image.rows
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
##
|
|
317
|
+
# Manipulate the image with RMagick. This method will load up an image
|
|
318
|
+
# and then pass each of its frames to the supplied block. It will then
|
|
319
|
+
# save the image to disk.
|
|
320
|
+
#
|
|
321
|
+
# === Gotcha
|
|
322
|
+
#
|
|
323
|
+
# This method assumes that the object responds to +current_path+.
|
|
324
|
+
# Any class that this module is mixed into must have a +current_path+ method.
|
|
325
|
+
# CarrierWave::Uploader does, so you won't need to worry about this in
|
|
326
|
+
# most cases.
|
|
327
|
+
#
|
|
328
|
+
# === Yields
|
|
329
|
+
#
|
|
330
|
+
# [Magick::Image] manipulations to perform
|
|
331
|
+
# [Integer] Frame index if the image contains multiple frames
|
|
332
|
+
# [Hash] options, see below
|
|
333
|
+
#
|
|
334
|
+
# === Options
|
|
335
|
+
#
|
|
336
|
+
# The options argument to this method is also yielded as the third
|
|
337
|
+
# block argument.
|
|
338
|
+
#
|
|
339
|
+
# Currently, the following options are defined:
|
|
340
|
+
#
|
|
341
|
+
# ==== :write
|
|
342
|
+
# A hash of assignments to be evaluated in the block given to the RMagick write call.
|
|
343
|
+
#
|
|
344
|
+
# An example:
|
|
345
|
+
#
|
|
346
|
+
# manipulate! do |img, index, options|
|
|
347
|
+
# options[:write] = {
|
|
348
|
+
# :quality => 50,
|
|
349
|
+
# :depth => 8
|
|
350
|
+
# }
|
|
351
|
+
# img
|
|
352
|
+
# end
|
|
353
|
+
#
|
|
354
|
+
# This will translate to the following RMagick::Image#write call:
|
|
355
|
+
#
|
|
356
|
+
# image.write do |img|
|
|
357
|
+
# self.quality = 50
|
|
358
|
+
# self.depth = 8
|
|
359
|
+
# end
|
|
360
|
+
#
|
|
361
|
+
# ==== :read
|
|
362
|
+
# A hash of assignments to be given to the RMagick read call.
|
|
363
|
+
#
|
|
364
|
+
# The options available are identical to those for write, but are passed in directly, like this:
|
|
365
|
+
#
|
|
366
|
+
# manipulate! :read => { :density => 300 }
|
|
367
|
+
#
|
|
368
|
+
# ==== :format
|
|
369
|
+
# Specify the output format. If unset, the filename extension is used to determine the format.
|
|
370
|
+
#
|
|
371
|
+
# === Raises
|
|
372
|
+
#
|
|
373
|
+
# [CarrierWave::ProcessingError] if manipulation failed.
|
|
374
|
+
#
|
|
375
|
+
def manipulate!(options={}, &block)
|
|
376
|
+
cache_stored_file! if !cached?
|
|
377
|
+
|
|
378
|
+
read_block = create_info_block(options[:read])
|
|
379
|
+
image = ::Magick::Image.read(current_path, &read_block)
|
|
380
|
+
frames = ::Magick::ImageList.new
|
|
381
|
+
|
|
382
|
+
image.each_with_index do |frame, index|
|
|
383
|
+
frame = yield(*[frame, index, options].take(block.arity)) if block_given?
|
|
384
|
+
frames << frame if frame
|
|
385
|
+
end
|
|
386
|
+
frames.append(true) if block_given?
|
|
387
|
+
|
|
388
|
+
write_block = create_info_block(options[:write])
|
|
389
|
+
|
|
390
|
+
if options[:format] || @format
|
|
391
|
+
frames.write("#{options[:format] || @format}:#{current_path}", &write_block)
|
|
392
|
+
move_to = current_path.chomp(File.extname(current_path)) + ".#{options[:format] || @format}"
|
|
393
|
+
file.content_type = Marcel::Magic.by_path(move_to).try(:type)
|
|
394
|
+
file.move_to(move_to, permissions, directory_permissions)
|
|
395
|
+
else
|
|
396
|
+
frames.write(current_path, &write_block)
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
destroy_image(frames)
|
|
400
|
+
rescue ::Magick::ImageMagickError
|
|
401
|
+
raise CarrierWave::ProcessingError, I18n.translate(:"errors.messages.processing_error")
|
|
402
|
+
end
|
|
403
|
+
|
|
404
|
+
private
|
|
405
|
+
|
|
406
|
+
def create_info_block(options)
|
|
407
|
+
return nil unless options
|
|
408
|
+
proc do |img|
|
|
409
|
+
options.each do |k, v|
|
|
410
|
+
if v.is_a?(String) && (matches = v.match(/^["'](.+)["']/))
|
|
411
|
+
CarrierWave.deprecator.warn "Passing quoted strings like #{v} to #manipulate! is deprecated, pass them without quoting."
|
|
412
|
+
v = matches[1]
|
|
413
|
+
end
|
|
414
|
+
img.public_send(:"#{k}=", v)
|
|
415
|
+
end
|
|
416
|
+
end
|
|
417
|
+
end
|
|
418
|
+
|
|
419
|
+
def destroy_image(image)
|
|
420
|
+
image.try(:destroy!)
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
def dimension_from(value)
|
|
424
|
+
return value unless value.instance_of?(Proc)
|
|
425
|
+
value.arity >= 1 ? value.call(self) : value.call
|
|
426
|
+
end
|
|
427
|
+
|
|
428
|
+
def rmagick_image
|
|
429
|
+
::Magick::Image.from_blob(self.read).first
|
|
430
|
+
end
|
|
431
|
+
|
|
432
|
+
end # RMagick
|
|
433
|
+
end # CarrierWave
|