如何显示指定目录中的图像
how to display the image from a specified directory
我把所有的图片都放在了D盘。
我 运行 一个网站,在 C: 驱动器中有 xampp 应用程序。
在我的显示图片页面中:
<img src="file:///D:/bea/PRODUCT/LB0064_19112015_160229/11-19-2015%209-47-21%20AM.png" class="img-thumbnail" alt="User Image" style="width: 100px;height: 100px;">
但是不显示。
如何在 D 驱动程序中显示图像。
谢谢
在 Apache 中,您通常会创建一个指向 http.conf
文件中特定文件夹位置的 alias
。我从未使用过甚至从未见过 xampp
,但我想在 xampp?
中会有一个等效的方法来这样做
通常会将所有文件放在服务器根目录中,但随着时间的推移,您将拥有多个项目,因此会出现重复。通过为各种文件夹(图像、javascript、xml 等)使用 alias
样式设置,可以从当时网络服务器上 运行 的任何项目轻松访问它们。
Alias /D_images "D:/path/to/images/"
<Directory "D:/path/to/images">
Options MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
然后,一旦服务器重新启动,您就可以访问目标目录中包含的文件,如:
<img src='/D_images/picture.jpg' />
将图像文件放入项目文件夹中。这是最佳做法。例如将图片放在你项目文件夹中名为'images'的文件夹中,然后按如下操作
<img src="http://localhost/images/11-19-2015%209-47-21%20AM.png" class="img-thumbnail" alt="User Image" style="width: 100px;height: 100px;">
将您的 image
放入 htdocs
目录中的项目文件夹中,以便可以访问。
<img src="PRODUCT/USER/FILE_NAME.png" class="img-thumbnail" alt="User Image" style="width: 100px;height: 100px;">
这是访问您的 image/file 的最佳方式。不要将它们与项目文件夹分开。
我把所有的图片都放在了D盘。 我 运行 一个网站,在 C: 驱动器中有 xampp 应用程序。 在我的显示图片页面中:
<img src="file:///D:/bea/PRODUCT/LB0064_19112015_160229/11-19-2015%209-47-21%20AM.png" class="img-thumbnail" alt="User Image" style="width: 100px;height: 100px;">
但是不显示。 如何在 D 驱动程序中显示图像。 谢谢
在 Apache 中,您通常会创建一个指向 http.conf
文件中特定文件夹位置的 alias
。我从未使用过甚至从未见过 xampp
,但我想在 xampp?
通常会将所有文件放在服务器根目录中,但随着时间的推移,您将拥有多个项目,因此会出现重复。通过为各种文件夹(图像、javascript、xml 等)使用 alias
样式设置,可以从当时网络服务器上 运行 的任何项目轻松访问它们。
Alias /D_images "D:/path/to/images/"
<Directory "D:/path/to/images">
Options MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
然后,一旦服务器重新启动,您就可以访问目标目录中包含的文件,如:
<img src='/D_images/picture.jpg' />
将图像文件放入项目文件夹中。这是最佳做法。例如将图片放在你项目文件夹中名为'images'的文件夹中,然后按如下操作
<img src="http://localhost/images/11-19-2015%209-47-21%20AM.png" class="img-thumbnail" alt="User Image" style="width: 100px;height: 100px;">
将您的 image
放入 htdocs
目录中的项目文件夹中,以便可以访问。
<img src="PRODUCT/USER/FILE_NAME.png" class="img-thumbnail" alt="User Image" style="width: 100px;height: 100px;">
这是访问您的 image/file 的最佳方式。不要将它们与项目文件夹分开。