【发布时间】:2015-08-20 18:39:44
【问题描述】:
我正在尝试从 AWS 切换到 Cloudinary 以管理我网站上的图像。我在 Rails 应用程序上使用 Cloudinary 和 CarrierWave,并按照 Cloudinary 的指南设置图像上传和存储 (http://cloudinary.com/documentation/rails_carrierwave)。当我尝试上传时出现此错误:
Cloudinary::CarrierWave::UploadError in UsersController#update
无效签名(已删除值)。要签名的字符串 - 'public_id=(value removed)sf×tamp=1433525724'。
这是我的用户控制器中的更新方法:
def update
@user = User.find(params[:id])
if @user.update_attributes(user_params)
flash[:notice] = "User information updated!"
redirect_to edit_user_registration_path
else
flash[:error] = "Error updating user information!"
redirect_to :back
end
end
def user_params
params.require(:user).permit(:name, :picture, :picture_cache)
end
这是我的上传文件:
class PictureUploader < CarrierWave::Uploader::Base
include Cloudinary::CarrierWave
version :main do
process :resize_to_fill => [300, 350]
end
# def scale(width, height)
# # do something
# end
# Create different versions of your uploaded files:
version :icon do
process :resize_to_fit => [18, 21]
end
version :small do
process :resize_to_fit => [54, 63]
end
version :profile do
process :resize_to_fit => [180, 210]
end
def extension_white_list
%w(jpg jpeg gif png)
end
end
非常感谢任何想法。谢谢!
【问题讨论】:
-
嗨,如果您(或其他任何人)仍然遇到类似问题,解决它的最佳方法可能是联系 Cloudinary via a support ticket。技术支持团队将很乐意检查该问题并帮助解决它。