渲染文件 Rails3
我正在尝试在 Rails3 的控制器中渲染 png 文件。我正在使用:
render :file=>'public/images/filename.png'
但是,输出似乎不是 PNG 文件(其内容以“PNG”开头 - 用curl 检查它 - 但它不是有效文件)。我在 Rails3 中找不到有关 render :file 的文档。语法为此改变了吗?即使这是 MIME 类型问题,我想我应该能够使用curl 获取该文件。
当使用 Fleximage 的图像(如果可用)时,我使用此技术来显示默认图像。 Fleximage 的图像可以正常工作,但这个简单的操作却不能正常工作。
I'm trying to render a png file in a controller in Rails3. I'm using:
render :file=>'public/images/filename.png'
However, the output seems not to be a PNG file (its contents start with "PNG" -checked it with curl- but it's not a valid file). I cannot find documentation on render :file in Rails3. Has the syntax changed for this? Even if it's a MIME type issue, I think I should be able to obtain the file with curl.
I'm using this technique to show a default image when using Fleximage's images if available. Fleximage's images work correctly, but this simple operation does not.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用:
use: