我们希望在亚马逊的S3服务上开始托管图像,但我们不想将所有现有图像上传到S3,而是希望从这些图像中提供这些“遗留”图像此刻托管&继续将所有新图像上传到S3,显然是为S3提供服务。
有没有人知道使用PaperClip或CarrierWave是否可行?
谢谢!
答案 0 :(得分:0)
如果您没有任何版本创建名为:s3_version
的版本(您喜欢的任何内容)
类似这样的事情
class YourUploader < CarrierWave::Base
storage :file
version :s3_version do
storage :fog
## As far as I know it would save the file with appending 's3_version_(your_file_name)
def full_filename(for_file)
super.gsub(/s3_version_/,"")
end
def filename
self.to_s.gsub(/s3_version_/,'')
end
end
我认为这样做可以在file
本地和S3
存储 I haven't tested this with multiple version
。
:from
但我想我也可以使用 version :thumb do
process resize_to_fill: [280, 280]
end
version :s3_thumb, :from_version => :thumb do
storage :s3
end
条款来完成
像这样的东西
{{1}}
尚未测试
希望这个帮助