-
-
Save nakamuraagatha/6c23edd0ef4e8d79866e to your computer and use it in GitHub Desktop.
Spina CMS with Cloudinary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rails generate uploader Web |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#config/cloudinary.yml | |
development: | |
cloud_name: yourcloudname | |
api_key: 'cloudinary_api_key' | |
api_secret: cloudinary_api_secret | |
enhance_image_tag: true | |
static_image_support: false | |
production: | |
cloud_name: yourcloudname | |
api_key: 'cloudinary_api_key' | |
api_secret: cloudinary_api_secret | |
enhance_image_tag: true | |
static_image_support: true | |
test: | |
cloud_name: yourcloudname | |
api_key: 'cloudinary_api_key' | |
api_secret: cloudinary_api_secret | |
enhance_image_tag: true | |
static_image_support: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#config/initializers/spina.rb | |
Spina::Engine.configure do | |
config.NEGATIVE_CAPTCHA_SECRET = 'b1cff6622e8739544d33cf5344102839d09e7e7f2cb5494a2055600d7b05ea1135f5fc0ac7cd0205fc9a2f09e01f143dc506f3f721209503ed6c41fe0520e93a' | |
# If you want to use s3 to store uploads | |
config.storage = :cloudinary | |
config.cloud_name = "cloudname" | |
config.api_key = "cloudinary_api_key" | |
config.api_secret = "cloudinary_api_secret" | |
config.enhance_image_tag = "true" | |
config.static_image_support = "false" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#app/uploaders/web_uploader.rb | |
class WebUploader < CarrierWave::Uploader::Base | |
include Cloudinary::CarrierWave | |
storage :file | |
def store_dir | |
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment