在解决我的项目中的图片问题时遇到问题。Rails 4,Heroku上的回形针不能识别破碎的图像
总结:Rilas 4托管在Heroku使用Paerclip与S3
问题开始与具有使用以前使用的自定义上传逻辑与S3。图片网址看起来像这样/profile_picture/:style_:image_hash
。它适用于那里的图像,但图像不存在的回形针仍然试图访问不存在的图像,实际的链接看起来像这样:http://s3.amazonaws.com/project/profile_pictures/100h_
。
has_attached_file :picture,
styles: { :'53h' => '', :'100h' => '' },
convert_options: {
:'100h' => '-gravity center -thumbnail 165x165^ -extent 165x165',
:'53h' => '-gravity center -thumbnail 45x45^ -extent 45x45'
},
path: 'profile_pictures/:style_:filename',
default_url: '/images/default-pp-large.jpg'
我猜测,可能是因为实际文件名中的风格,但我不知道,eather方式defauly_url
不能正常工作和图像全部被破坏,不包括实际上存在的人。
你能帮忙吗?
我不能这样做,因为,就像我说的,迁移与现有的S3文件来了,所以改变实际路径文件是不是一种选择。 – user2945241