Img Src在本地电脑上 [英] Img Src on local computer

查看:282
本文介绍了Img Src在本地电脑上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想这是一个常见的初学者问题,但是我没有发现任何可以覆盖我的问题的回复:我无法链接到本地​​计算机上的图像。



我正在为wordpress安装制作主题(在运行Windows 7的戴尔上使用Xampp)。我的 index.php 文件位于:

  C:\xampp\htdocs\tutorials\wordpress\wp- content\themes\LeftColumn\ index.php 

我要展示的图片是:

  C:\xampp\htdocs\tutorials\wordpress\wp- content\themes\LeftColumn\images\pmsplogo.jpg 

...虽然我尝试了很多变化,但是我没有把< img src =/> 似乎正在工作。任何人都可以解释什么是正确的方式来编码这是适合我的情况吗?



请注意,它会正确显示来自外部网站的图像(如: http://littlewebhut.com/images/eightball.gif

感谢!

解决方案

通常IE可以使用像 C:\\ \\ ,但其他浏览器需要更多。使用 file:/// C:/ 开始路径,然后通过Windows资源管理器填写文件路径的其余部分。



但最好考虑相对路径 - ../../ images / src =img.gif。这将是从当前位置开始的两个目录,然后进入图像目录。


I imagine that this is a common beginner question, but I've found no responses that quite cover my problem: I am having trouble linking to an image on my local computer.

I'm working on making a theme for a wordpress installation (on a Dell running Windows 7 using Xampp.) My index.php file is located at:

C:\xampp\htdocs\tutorials\wordpress\wp-content\themes\LeftColumn\index.php

and the image I want to show is at:

C:\xampp\htdocs\tutorials\wordpress\wp-content\themes\LeftColumn\images\pmsplogo.jpg

... and while I've tried many variations, somehow nothing I put in the <img src=""/> seems to be working. Can anyone explain what the right way to code this is for my situation?

Just to note, it will properly display an image from an external website (such as: http://littlewebhut.com/images/eightball.gif)

Thanks!

解决方案

Generally IE is OK with a path like C:\, but other browsers need something more. Start the path with file:///C:/ and then fill in the rest of the path to the file through Windows Explorer.

But it might be best to consider relative paths - ../../images/src="img.gif" - for example. This would be two directories up from the current location, and then into the images directory.

这篇关于Img Src在本地电脑上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆