本地图像和Opera [英] Local images and Opera

查看:74
本文介绍了本地图像和Opera的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!


我不擅长构建网页,但我正在尝试从网站加载本地图像。这是我的代码:

Hi there!

I''m not that good at building webpages, but I''m trying to load a local image from a website. Here''s my code:

展开 | 选择 | Wrap | 行号

推荐答案

相对路径是否有效?


如果网站位于网络服务器上且图像在我的硬盘上,这些相对路径应该是什么样的?我无法想象如何做到这一点,但如果你能解释一下,我会很乐意去测试它。


问候,

Nepomuk
What should these relative paths look like, if the website is on a webserver and the image is on my harddrive? I can''t imagine how to do that, but if you can explain, I''d be happy to test it.

Greetings,
Nepomuk


通常在测试网站时,你在服务器上运行它们(你的机器上的localhost以后 www.host.tld )。


a相对路径是你从当前目录开始爬上你的图像的地方(argh,更好地使用一个例子)


服务器root(absolute,localhost):/ var / www /

图像路径(绝对,localhost):/ var / www / img / my_pic.png

页面路径(绝对路径) ,localhost):/ var / www / pages / my_file.html
图片路径(相对,localhost):../ img / my_pic.png (一个文件夹下来,然后进入img / )

图像路径(绝对,http由localhost) http:// localhost / img / my_pic.png


(如果您没有自己托管......,实际路径可能会有所不同)

服务器root(绝对值,www):/ var / nepomuk / www /

图像路径(绝对值,www):/ var / nepomuk / www / img / my_pic.png

页面路径(绝对,www):/ var / nepomuk / www / pages / my_file.html
图像路径(相对,www):.. / img / my_pic.png

图像路径(绝对值,www http) http://www.host.tld/img/my_pic.png


a浏览器通常不应该尝试通过绝对路径获取图像(这是暴露您的文件系统结构)。如果我记得正确的文件://强制浏览器在本地硬盘上查找图像(大多数情况下图像不是这样)


如果你想从webserver(www)是您计算机的图像(localhost),您需要a)您的服务器正在运行,b)http:// request
usually when testing websites, you run them on a server (localhost on your machine later www.host.tld).

a relative path is where you start at the current directory climbing up and down to your image (argh, better using an example)

server root (absolute, localhost): /var/www/
image path (absolute, localhost): /var/www/img/my_pic.png
page path (absolute, localhost): /var/www/pages/my_file.html
image path (relative, localhost): ../img/my_pic.png (one folder down, then into img/)
image path (absolute, localhost by http) http://localhost/img/my_pic.png

(provided you''re not hosting yourself..., actual paths may differ)
server root (absolute, www): /var/nepomuk/www/
image path (absolute, www): /var/nepomuk/www/img/my_pic.png
page path (absolute, www): /var/nepomuk/www/pages/my_file.html
image path (relative, www): ../img/my_pic.png
image path (absolute,www by http) http://www.host.tld/img/my_pic.png

a browser usually should not try to get an image via absolute paths (this is exposing your file system structure). and if I remember right file:// forces the browser to look for the image on the local hard disk (where in most cases the image is not)

if you want to access from the webserver (www) an image of your computer (localhost), you need a) your server running, b) a http:// request


这篇关于本地图像和Opera的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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