carrierwave_gallery 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/uploaders/image_uploader.rb +6 -40
- data/lib/carrierwave_gallery/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 659c4daef7fbac3e5e6abc07c1028967cb620113
|
4
|
+
data.tar.gz: f366451e4a34b512645cac9dbc37a594a5e3347d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ba4ea4116e757f1bd88bc8d4deebaf5aa2676163b47078f0139ce89e89708f8abeef42f9fcfda5a6c995c816459664d1f7dee5b8b16e0efb0287b03a043fcc5
|
7
|
+
data.tar.gz: d512490925af91acea933d3f478c701d4593882c94a06dcb637220049b6864f4338a8d7c956c4f2e6b25f284c91e3d24d2fadde762524c27a034ecaccf4920e9
|
@@ -1,56 +1,22 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
class ImageUploader < CarrierWave::Uploader::Base
|
4
|
-
# Include RMagick or MiniMagick support:
|
5
2
|
include CarrierWave::RMagick
|
6
|
-
# include CarrierWave::MiniMagick
|
7
3
|
|
8
|
-
# Choose what kind of storage to use for this uploader:
|
9
4
|
storage :file
|
10
|
-
# storage :fog
|
11
5
|
|
12
|
-
# Override the directory where uploaded files will be stored.
|
13
|
-
# This is a sensible default for uploaders that are meant to be mounted:
|
14
6
|
def store_dir
|
15
7
|
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
16
8
|
end
|
17
9
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
|
22
|
-
#
|
23
|
-
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
24
|
-
# end
|
25
|
-
|
26
|
-
# Process files as they are uploaded:
|
27
|
-
# process :scale => [200, 300]
|
28
|
-
#
|
29
|
-
# def scale(width, height)
|
30
|
-
# # do something
|
31
|
-
# end
|
32
|
-
|
33
|
-
#process :resize_to_fill => [800, 800]
|
10
|
+
version :medium do
|
11
|
+
process :resize_to_fit => [800, 800]
|
12
|
+
end
|
34
13
|
|
35
|
-
# Create different versions of your uploaded files:
|
36
14
|
version :thumb do
|
37
15
|
process :resize_to_fill => [160, 160]
|
38
16
|
end
|
39
17
|
|
40
|
-
|
41
|
-
|
18
|
+
def extension_white_list
|
19
|
+
%w(jpg jpeg gif png)
|
42
20
|
end
|
43
|
-
|
44
|
-
# Add a white list of extensions which are allowed to be uploaded.
|
45
|
-
# For images you might use something like this:
|
46
|
-
# def extension_white_list
|
47
|
-
# %w(jpg jpeg gif png)
|
48
|
-
# end
|
49
|
-
|
50
|
-
# Override the filename of the uploaded files:
|
51
|
-
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
52
|
-
# def filename
|
53
|
-
# "something.jpg" if original_filename
|
54
|
-
# end
|
55
|
-
|
56
21
|
end
|
22
|
+
|