简体   繁体   English

如何直接从Web应用程序访问本地文件系统上的图像?

[英]How to access images on the local file system directly from a web app?

For example: 例如:

<html>
<body>
<img src="E:\webappimages\ab.jpg">
</body>
</html>

This static page works if it's simply opened with a browser. 如果仅通过浏览器打开此静态页面,则该页面有效。

But if I copy the same html document to src/main/resources/static directory of a webapp in the eclipse ide and serve it using tomcat ,Then the image ab.jpg do not show up in the served webpage. 但是,如果我将相同的html文档复制到eclipse ide Webapp的src/main/resources/static目录中,并使用tomcat投放,则图像ab.jpg不会显示在所提供的网页中。

How to access images in the file system directly from html and css that is part of a webapp & without having to explicitly copy images to src/main/resources/... directories of the project? 如何直接从Web应用程序的一部分htmlcss访问文件系统中的图像,而不必显式复制图像到项目的src/main/resources/...目录?

If you want a static resource that everyone can link to, try setting up a developer's account on Amazon S3. 如果您希望每个人都可以链接到静态资源,请尝试在Amazon S3上设置开发人员帐户。 You can add any images you would like to there, generate a public link to them, and reference that link in your image tag. 您可以在其中添加任何想要的图像,为它们生成公共链接,然后在图像标签中引用该链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从已部署的Web应用程序访问本地文件系统上的文件? - how to access files on local file system from deployed web app? 是否可以使用 Okhttp 从文件系统访问本地文件 - is it possible to access local file from file system using Okhttp Java Web App无法访问linux文件系统 - java web app cant access linux file system 从 java web 应用程序访问 linux 本地文件系统 - Accessing linux local file system from java web application Java Web服务器显示文件系统中的图像? - Java Web server display images from file system? 如何从文件系统调用图像? - How to call images from file system? 从在码头运行的Web应用程序访问本地目录图像 - Access local directory image from web app running in jetty 如何从现有的Web应用程序访问HDFS(Hadoop文件系统) - How can I access the HDFS(Hadoop File System) from existing web application 用于从Web进行文件系统访问的Java Applet的替代方案 - Alternative to Java Applet for File System Access from Web Play Framework如何从本地运行和Web应用程序将conf文件夹中的文件作为Java InputStream引用 - Play Framework how to reference a file in conf folder as Java InputStream from local run and web app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM