我有RoR項目,生活在heroku上。我有bootsy(編輯器與圖像上傳funcs),我有cloudinary。 我設置了上傳器,cloudinary api鍵和初始化器(如果需要,可以顯示你)。現在,當我嘗試在bootsy中上傳圖像時 - 它會創建數據庫行,並在cloudinary中創建圖像。但是,在從bootsy JS窗口中,有空<img>
Ruby on rails bootsy + cloudinary上傳圖片麻煩
ruby '2.3.1'
gem 'rails', '~> 5.1.1'
gem 'bootsy'
gem 'carrierwave'
gem 'fog'
gem 'cloudinary', '~> 1.8.1'
1)上傳/ bootsy/image_uploader.rb
module Bootsy
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
# storage Bootsy.storage
include Cloudinary::CarrierWave
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
version :large do
process :eager => true
process resize_to_fit: [
700, 700
]
end
version :medium do
process :eager => true
process resize_to_fit: [
300, 300
]
end
version :small do
process :eager => true
process resize_to_fit: [
150, 150
]
end
version :thumb do
process :eager => true
process resize_to_fit: [
150, 150
]
end
def extension_white_list
%w(jpg jpeg gif png)
end
end
end
2)初始化/ bootsy.rb
Bootsy.setup do |config|
config.image_versions_available = [:small, :medium, :large, :original]
config.storage = :fog
end
3)模型/article.rb
class Article < ApplicationRecord
include Bootsy::Container
mount_uploader :image, Bootsy::ImageUploader
mount_uploader :main_image, ArticleImageUploader
mount_uploader :list_image, ArticleImageUploader
end
P.S好吧,我真的不知道 - 我只是在公共存儲庫中重複這個錯誤。 https://bitbucket.org/dekakisalove/bootsy_tes/我會盡快爲這個問題增加賞金。
請添加任何錯誤信息和日誌輸出,否則我們無法診斷問題。 –
@Зелёный我已經展示了屏幕。沒有錯誤消息。只是一個空的img。在軌道日誌 - 一切看起來也沒問題。在cloudinary圖像創建。在數據庫行中創建 – Legendary
如果您知道,還有webbrowser控制檯。 –