是否有最佳的目录将图像上传到heroku? [英] Is there a best directory to place image uploads on heroku?

查看:72
本文介绍了是否有最佳的目录将图像上传到heroku?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用载波,我想更改存储图像的目录。

I'm using carrierwave and I want to change the directory where images are stored.

现在图像URL为/uploads/modelname/image/51/nameoffile.jpg

Right now the image URL is /uploads/modelname/image/51/nameoffile.jpg

store_dir在ImageUploader中

the store_dir in ImageUploader is

def store_dir
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
  end

我绝对不希望该模型名显示
是否存在将图像存储在heroku上的可接受的理想路径?

I definitely do not want the modelname to show Is there an accepted ideal path where images should be stored on heroku?

推荐答案

Heroku不允许上传到他们的服务器。您需要使用其他存储介质,例如Amazon的S3。

Heroku doesn't allow uploads to their servers. You need to use another storage medium, like Amazon's S3.

我实际上是在使用Parse(www.parse.com)API在其解决方案上存储图像。但这取决于您需要如何访问图像。

I'm actually using Parse's (www.parse.com) API to store images on their solution. But it depends how you need access to your images.

这篇关于是否有最佳的目录将图像上传到heroku?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆