paperclip_utils 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/paperclip_utils/version.rb +1 -1
- data/lib/paperclip_utils.rb +6 -4
- 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: 1a56dbe7fd83b32d54e8e6a1d27c290c18bce57b
|
4
|
+
data.tar.gz: d458ec5792f1be88c377c635e91d9555ec1488fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93ab00047ac3dfa0c37887325be198c924640037ec221c752e6ab92c5a43000d9a3e7f6657a5841b7fe042ae44329072bd664f50bc1fceb032aa2ec2100c2f9d
|
7
|
+
data.tar.gz: 5013432814851cab2c89dde719a355e0155b1a54d683aadb9a22fa6a67a8acbc9978037f840deb6c91a5509e3bb0522f916347f7fdf5521d95e5c40204bc54e3
|
data/lib/paperclip_utils.rb
CHANGED
@@ -17,11 +17,13 @@ module Paperclip
|
|
17
17
|
return (allowed_content_types.include?(content_type) ? processors : fallback_processors)
|
18
18
|
end
|
19
19
|
|
20
|
-
def self.get_styles(content_type, to_styles
|
20
|
+
def self.get_styles(content_type, options={to_styles: nil, fallback_styles: {}, allowed_content_types: ALLOWED_CONTENT_TYPES})
|
21
|
+
to_styles = options[:to_styles]
|
22
|
+
|
21
23
|
if to_styles
|
22
|
-
if ['application/pdf','image/tiff','image/tif','image/x-tiff'].include?(content_type)
|
24
|
+
if ['application/pdf','image/tiff','image/tif','image/x-tiff'].include?(content_type)
|
23
25
|
to_styles.each do |k,v|
|
24
|
-
to_styles[k] = [v, :jpg]
|
26
|
+
to_styles[k] = [(v.is_a?(String) ? v : v[0]), :jpg]
|
25
27
|
end
|
26
28
|
end
|
27
29
|
else
|
@@ -31,7 +33,7 @@ module Paperclip
|
|
31
33
|
to_styles = {preview: "800x600>", thumb: "100x100>"}
|
32
34
|
end
|
33
35
|
end
|
34
|
-
return (allowed_content_types.include?(content_type) ? to_styles : fallback_styles)
|
36
|
+
return (options[:allowed_content_types].include?(content_type) ? to_styles : options[:fallback_styles])
|
35
37
|
end
|
36
38
|
|
37
39
|
ALLOWED_CONTENT_TYPES = ['application/pdf', 'image/png', 'image/x-png', 'image/gif', 'image/jpeg', 'image/pjpeg', 'image/jpg', 'image/tif', 'image/tiff', 'image/x-tiff']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paperclip_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Weston Ganger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: paperclip
|