简体   繁体   English

我无法使用 html 在我的 /var/www/efs/image/ 文件夹中获取图像<img src>

[英]I cant get the image in my /var/www/efs/image/ folder using html <img src>

I am working on my project that will get the image based on users ID.我正在开发我的项目,该项目将根据用户 ID 获取图像。 My image stored in /var/www/efs/image folder.我的图像存储在 /var/www/efs/image 文件夹中。 I tried to put the directory like this <img src={"/var/www/efs/images/"} runat="server" ></img> but it just cant see it.我试图像这样放置目录<img src={"/var/www/efs/images/"} runat="server" ></img>但它就是看不到它。 when i check the error, it says 404 and it just append my directory to my website (https://mywebsite.com/var/www/efs/images/subscriber_image.png) .当我检查错误时,它显示 404,它只是 append 我的目录到我的网站(https://mywebsite.com/var/www/efs/images/subscriber_image.png)

why is that I cant get my image?为什么我无法获取我的图像? What should I do?我应该怎么办? Thanks in advance for the answer:) hope someone can help me with this.提前感谢您的回答:) 希望有人可以帮助我。 im stuck:(我卡住了:(

btw im using amazon linux顺便说一句,我使用亚马逊 linux

This is because the src attribute is looking for a hosted resource or a local internal resource.这是因为 src 属性正在寻找托管资源或本地内部资源。 You can't use a resource located in the system that isn't exposed via the website files/project.您不能使用系统中未通过网站文件/项目公开的资源。 This is because of system security issues.这是因为系统安全问题。 So in short, if you want to access that file, move it so an assets folder within your website's project.简而言之,如果您想访问该文件,请将其移动到您网站项目中的资产文件夹中。

try The absolute path <img src="//www.jquery-az.com/html/images/banana.jpg" title="Title of image" alt="alt text here"/>试试绝对路径<img src="//www.jquery-az.com/html/images/banana.jpg" title="Title of image" alt="alt text here"/>

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM