从 root 提供静态资源,无需在 Rails 中添加时间戳
为了从 Apple 触摸设备上的 Rails 应用程序自定义主屏幕图标,我需要从根目录提供图像。
我需要像
www.mywebsite.com/an_image.png
这样的东西来提供图像。我已经部署在 Heroku 上,所以我什至不知道是否可以破坏 Web 服务器配置。如果有的话,我洗耳恭听。如果有一种方法可以在 Rails 内完成这一切,那也是可行的。
有人对此有任何指导吗?
In order to customize the homescreen icon from my rails app on Apple touch devices, I need to serve an image out of the root.
I need something like
www.mywebsite.com/an_image.png
to serve up the image. I've deployed on Heroku, so I don't even know if it's possible to muck with the web server configuration. If there is, I'm all ears. If there's a way to do it all within rails that would work too.
Does anyone have any guidance on this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试将
an_image.png
放入 Rails 应用的public
目录中。没有规定所有图像都必须放在images
子文件夹中。Try putting
an_image.png
in your Rails app'spublic
directory. There is no rule saying that all images must go in theimages
subfolder.您的公共目录中有一个名为 images 的文件夹。
myapp/public/images
。继续将图像粘贴在那里。您需要根据 apply 的配置方式来命名图像。这是我的一个应用程序的快照:
您可以看到它需要遵循此格式才能按顺序显示为“本机应用程序图标”:
还可以在 google 上搜索您的特定设备并确保命名约定正确。
您可能想将其添加到标头中,以便您的网络应用程序看起来像本机应用程序:
There is a folder in your public directory called images.
myapp/public/images
. Go ahead and stick the image in there.You need to name your images according to how apply has it configured. Here is a snapshot of one of my apps:
You can see that it needs to follow this format in order to show up as the 'native app icon':
Also google your specific devise and make sure you get the naming convention correct.
You probably want to add this to your header so your web-app looks like a native app: