Rails 加载未保存在图像文件夹中的图标
我想预览一下刚刚上传的图片。这些图片没有保存在公共文件夹中,因为它们不是公开的...
我该怎么做?
谢谢 马库斯
I wand to give a preview of the just uploaded pictures. These pictures are not saved in the public folder, as they are not public...
How can I do this?
Thanks
Markus
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要创建一个控制器来发送文件( http://api.rubyonrails .org/classes/ActionController/Streaming.html#method-i-send_file )它。
在此控制器中,您可以添加所需的所有授权。
You need create a Controller to send_file ( http://api.rubyonrails.org/classes/ActionController/Streaming.html#method-i-send_file ) it.
In this controller you can add all authorization you want.
您可以:
1)创建指向图像的符号链接
公共文件夹?
2)如你所是
他们公开使用这些图像
确实应该在公众面前
文件夹 - 为什么它们目前没有?
You could:
1) Create symlink to the images in
the public folder?
2) As you are
using the images publicly, they
should really be in the public
folder - why are they currently not?