caboose-cms 0.7.67 → 0.7.68
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/app/models/caboose/media.rb +27 -0
- data/lib/caboose/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: 03568cf8eb491dc1e643540ffa115268a18ddda0
|
4
|
+
data.tar.gz: 095c394843f638a1414782aefee172d834ce29f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c071f43146f9c50b65ced7e2e9089ef1f5e65bba1786d64000381bb23884d199a8b2a4bab645427013ab195b1757776d40239ddc02eca784117ea8b5c03caf8e
|
7
|
+
data.tar.gz: 45e5984a04c276979ae7caafbf0ec66daa1f3c4cac230150bf8dd548010fa96d66312b98bfb0d874776d7954164d21781cea8f30eec51994a1671c28ea776bee
|
data/app/models/caboose/media.rb
CHANGED
@@ -74,6 +74,33 @@ class Caboose::Media < ActiveRecord::Base
|
|
74
74
|
|
75
75
|
end
|
76
76
|
|
77
|
+
def set_image_content_type(content_type)
|
78
|
+
config = YAML.load(File.read(Rails.root.join('config', 'aws.yml')))[Rails.env]
|
79
|
+
AWS.config({
|
80
|
+
:access_key_id => config['access_key_id'],
|
81
|
+
:secret_access_key => config['secret_access_key']
|
82
|
+
})
|
83
|
+
bucket = config['bucket']
|
84
|
+
ext = File.extname(self.image_file_name)[1..-1]
|
85
|
+
self.image.styles.each do |style|
|
86
|
+
k = "media/#{self.id}_#{self.name}_#{style}.#{ext}"
|
87
|
+
bucket.objects[k].copy_from(k, :content_type => content_type) # a copy needs to be done to change the content-type
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def set_file_content_type(content_type)
|
92
|
+
config = YAML.load(File.read(Rails.root.join('config', 'aws.yml')))[Rails.env]
|
93
|
+
AWS.config({
|
94
|
+
:access_key_id => config['access_key_id'],
|
95
|
+
:secret_access_key => config['secret_access_key']
|
96
|
+
})
|
97
|
+
bucket = config['bucket']
|
98
|
+
ext = File.extname(self.image_file_name)[1..-1]
|
99
|
+
has_attached_file :file, :path => ':caboose_prefixmedia/:id_:media_name.:extension'
|
100
|
+
k = "media/#{self.id}_#{self.name}.#{ext}"
|
101
|
+
bucket.objects[k].copy_from(k, :content_type => content_type) # a copy needs to be done to change the content-type
|
102
|
+
end
|
103
|
+
|
77
104
|
def download_image_from_url(url)
|
78
105
|
self.image = URI.parse(url)
|
79
106
|
self.processed = true
|
data/lib/caboose/version.rb
CHANGED