carrierwave-bombshelter 0.1.0.1 → 0.1.0.2
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 +4 -4
- data/README.md +3 -3
- data/lib/carrierwave/bombshelter.rb +5 -5
- data/lib/carrierwave/bombshelter/version.rb +1 -1
- data/lib/locale/en.yml +1 -1
- data/lib/locale/ru.yml +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: c830e118a3048b76347216008b0f720fd2bbb59e
|
4
|
+
data.tar.gz: aece90372866fb87faaf591293ab5d16a78783b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08b443db602a3b6ba29e16983f8e807d2db799a81853802ce8dc67c546676384f88a98f9b8bc00d2b40006842fd45225e7ecbb6a47d39d91bf96983fa187bd6e
|
7
|
+
data.tar.gz: cccd0d26230e80c9500a94988ba5e916ddb9ced50099f1aab5d0d035fe407893ac843b7f87d8217cbaf51bccb9f31dfdac26cdee4aa75a44e96e150221b25e29
|
data/README.md
CHANGED
@@ -38,13 +38,13 @@ class YourUploader < CarrierWave::Uploader::Base
|
|
38
38
|
end
|
39
39
|
```
|
40
40
|
|
41
|
-
By default BombShelter sets maximum allowed dimensions to 4096x4096, but you can set your own ones by defining `
|
41
|
+
By default BombShelter sets maximum allowed dimensions to 4096x4096, but you can set your own ones by defining `max_pixel_dimensions` method:
|
42
42
|
|
43
43
|
```ruby
|
44
44
|
class YourUploader < CarrierWave::Uploader::Base
|
45
45
|
include CarrierWave::BombShelter
|
46
46
|
|
47
|
-
def
|
47
|
+
def max_pixel_dimensions
|
48
48
|
[1024, 1024]
|
49
49
|
end
|
50
50
|
end
|
@@ -52,7 +52,7 @@ end
|
|
52
52
|
|
53
53
|
## Contributing
|
54
54
|
|
55
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/DarthSim/carrierwave-bombshelter. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
55
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/DarthSim/carrierwave-bombshelter. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org/) code of conduct.
|
56
56
|
|
57
57
|
## License
|
58
58
|
|
@@ -14,24 +14,24 @@ module CarrierWave
|
|
14
14
|
extend ActiveSupport::Concern
|
15
15
|
|
16
16
|
included do
|
17
|
-
before :cache, :
|
17
|
+
before :cache, :check_pixel_dimensions!
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
20
|
+
def max_pixel_dimensions
|
21
21
|
[4096, 4096]
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
25
25
|
|
26
|
-
def
|
26
|
+
def check_pixel_dimensions!(new_file)
|
27
27
|
sizes = FastImage.size(new_file.path)
|
28
|
-
max_sizes =
|
28
|
+
max_sizes = max_pixel_dimensions
|
29
29
|
|
30
30
|
return if !sizes || (sizes[0] <= max_sizes[0] && sizes[1] <= max_sizes[1])
|
31
31
|
|
32
32
|
fail CarrierWave::IntegrityError,
|
33
33
|
I18n.translate(
|
34
|
-
:'errors.messages.
|
34
|
+
:'errors.messages.pixel_dimensions_error',
|
35
35
|
x_size: max_sizes[0], y_size: max_sizes[1]
|
36
36
|
)
|
37
37
|
end
|
data/lib/locale/en.yml
CHANGED
data/lib/locale/ru.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carrierwave-bombshelter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DarthSim
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|