oxen_media 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/uploaders/medium_uploader.rb +53 -6
- data/lib/oxen_media/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c69de63f7847a197faea01c7d352f922815ebcd
|
4
|
+
data.tar.gz: c54b2e59ce73282b745f6b07640370bb683367c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e47a6caac9b15fa734d9f70ad156933d9fe5a7c8ba59b5f1050249446dcde86e473fd977c35cb8b0f2e8d7473a7c83094109e24ee1fa54ffdba88d3045890970
|
7
|
+
data.tar.gz: 5749a23c35f46abc93e317b6a3375dfccb35973a7106c1eb59622af3808893373bb1f283219506299d5bdff3eb4b33c683a8dbce1696165813d0a5589af1c531
|
@@ -67,6 +67,9 @@ class MediumUploader < CarrierWave::Uploader::Base
|
|
67
67
|
end
|
68
68
|
|
69
69
|
|
70
|
+
resize_to_limit(1024, 768)
|
71
|
+
|
72
|
+
|
70
73
|
# Process files as they are uploaded:
|
71
74
|
# process :scale => [200, 300]
|
72
75
|
#
|
@@ -74,17 +77,61 @@ class MediumUploader < CarrierWave::Uploader::Base
|
|
74
77
|
# # do something
|
75
78
|
# end
|
76
79
|
|
77
|
-
# Create different versions of your uploaded files:
|
78
|
-
# version :thumb do
|
79
|
-
# process :resize_to_fit => [50, 50]
|
80
|
-
# end
|
81
80
|
|
82
81
|
# Add a white list of extensions which are allowed to be uploaded.
|
83
82
|
# For images you might use something like this:
|
84
|
-
|
85
|
-
|
83
|
+
def extension_white_list
|
84
|
+
%w(jpg jpeg gif png)
|
85
|
+
end
|
86
|
+
|
87
|
+
# Override the filename of the uploaded files:
|
88
|
+
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
89
|
+
# def filename
|
90
|
+
# "something.jpg" if original_filename
|
86
91
|
# end
|
87
92
|
|
93
|
+
|
94
|
+
version :large do
|
95
|
+
process :crop
|
96
|
+
end
|
97
|
+
|
98
|
+
version :preview do
|
99
|
+
process :crop
|
100
|
+
resize_to_limit(690, 518)
|
101
|
+
end
|
102
|
+
|
103
|
+
version :thumb do
|
104
|
+
process :crop
|
105
|
+
resize_to_fill(100, 100)
|
106
|
+
end
|
107
|
+
|
108
|
+
|
109
|
+
def crop
|
110
|
+
if model.crop_x.present?
|
111
|
+
manipulate! do |img|
|
112
|
+
x = model.crop_x.to_i
|
113
|
+
y = model.crop_y.to_i
|
114
|
+
w = model.crop_w.to_i
|
115
|
+
h = model.crop_h.to_i
|
116
|
+
img = img.crop(x, y, w, h)
|
117
|
+
img
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def convert_to_grayscale
|
123
|
+
manipulate! do |img|
|
124
|
+
img.colorspace = Magick::GRAYColorspace
|
125
|
+
img
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def brightness
|
130
|
+
manipulate! do |img|
|
131
|
+
img.modulate(1.20, 0.5, 1.2)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
88
135
|
# Override the filename of the uploaded files:
|
89
136
|
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
90
137
|
# def filename
|
data/lib/oxen_media/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oxen_media
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Walther H Diechmann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|