473,320 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Local images and Opera

Nepomuk
3,112 Expert 2GB
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:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <title>testpage</title>
  4. </head>
  5. <body>
  6. <img src="file:///home/nepomuk/Pics/pic.png"/>
  7. </body>
  8. </html>
The whole thing does work, as long as it's on my harddrive, but as soon as I upload it to a server, the image isn't shown under Opera. It does however work with Firefox, no problem at all. I searched with Google and couldn't find a solution to this problem.

Any ideas?

Greetings,
Nepomuk
Feb 2 '09 #1
16 2672
Dormilich
8,658 Expert Mod 8TB
do relative paths work?
Feb 2 '09 #2
Nepomuk
3,112 Expert 2GB
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
Feb 2 '09 #3
Dormilich
8,658 Expert Mod 8TB
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
Feb 2 '09 #4
Nepomuk
3,112 Expert 2GB
Ah, that's what you mean.

Well, in this case I do want the browser to access a file on my harddrive, even though the website is not, without a webserver running locally. The reason is that I'm testing stuff for GFX-Packs for a browser game. So users should be able to download the images and then load them from their own harddrive - that way the server has less work to do and the users can edit the images themselves, if they want to.

So, the problem remains. Any further ideas?

Greetings,
Nepomuk
Feb 2 '09 #5
drhowarddrfine
7,435 Expert 4TB
@Dormilich
Correct.
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
You can use ActiveX but that only works on Windows and then I think you'd have security popups all the time. Firefox has Prism which would work wonderfully everywhere. I was just reading an article where javascript can do this but I don't recall how it would tie in with a browser, something Prism does.

I'll see if I can find that article.

EDIT: The article isn't directly related but I'm supplying the link in case you glean anything good from it.
Feb 2 '09 #6
Nepomuk
3,112 Expert 2GB
@drhowarddrfine
Well, I wouldn't want to use ActiveX for it. I would guess that if you write something for Prism, it won't work in other browsers, will it?
@drhowarddrfine
That would be great, thanks!
@drhowarddrfine
Well, that does seem a bit over the top, doesn't it? I'm not planning on building anything with GTK or QT. ^^

Greetings,
Nepomuk
Feb 2 '09 #7
Dormilich
8,658 Expert Mod 8TB
@Nepomuk
usually, images are cached in the browser, and if the expires header says it will be valid for some years.... there wouldn't be much requests.
Feb 2 '09 #8
Nepomuk
3,112 Expert 2GB
In theory, yes. But a) the cache has to be deleted ever so often (with this game much more often than normally) and b) you can't really edit them conveniently.

As I said, that code works just fine in Firefox and apparently in IE too. But in Opera it won't show the picture. Mind you, it will show the picture if you just enter the address line into the address line. But not within that html file, when the it is on an external server.

Greetings,
Nepomuk
Feb 2 '09 #9
drhowarddrfine
7,435 Expert 4TB
@Nepomuk
Prism would act like an app, not a browser, though it is the Firefox browser without the skin. Could it interact with other browsers? Don't know.
Well, that does seem a bit over the top, doesn't it? I'm not planning on building anything with GTK or QT.
That's why I said it was unrelated but thought there might be a tip you could pick up from the article.
Feb 2 '09 #10
Nepomuk
3,112 Expert 2GB
OK, I'll have a look at it. But isn't there a more simple method? Something with just HTML and maybe some CSS ideally? ^^

Greetings,
Nepomuk
Feb 2 '09 #11
David Laakso
397 Expert 256MB
@Nepomuk

Yes. Opera is too smart to be taken in by that flaky gimmick...

"You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time."
-- Abraham Lincoln
Feb 4 '09 #12
Nepomuk
3,112 Expert 2GB
@David Laakso
I assume you're saying that other browsers shouldn't let this work either, but I'm not quite sure, why not. Could you explain further? Because if it's a feature instead of a bug, I'd love to understand, why.

Still hoping it can be done somehow.

Greetings,
Nepomuk
Feb 4 '09 #13
David Laakso
397 Expert 256MB
I suppose there may be some correlation between between wishing something could be done and what appears to be reality. But I do not know what it is. All of this seems rather mysterious and elliptical.

Is your goal to hide the image from the sight of search engines and the public but to have the image available for download by an individual or group of individuals?

If so, have you considered simply uploading the image to your server. Locking the directory/folder it is in. And providing the uri, login, and password for it only to those with whom you wish to grant permission to download it?
Feb 4 '09 #14
Nepomuk
3,112 Expert 2GB
Not really - the idea is to have the option to save the images either locally or on a different server, so that they don't have to be loaded every time one opens the website. Also that way the images could be changed locally. The Cache just isn't enough all of the time.

Quite a lot of browser games have such an option available (GFX-Packs), but I don't know how they deal with Opera.

Greetings,
Nepomuk
Feb 4 '09 #15
David Laakso
397 Expert 256MB
Got it! Generation gap. Bows. Scrapes. Best wishes for success.
~d
Feb 5 '09 #16
Nepomuk
3,112 Expert 2GB
Thanks. Haven't found a way yet, but I'll keep on looking.

Greetings,
Nepomuk
Feb 5 '09 #17

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Lijun Yang | last post by:
Hey, I am able to disable the right mouse button on images for netscape and IE but it won't work for Opera. Here is the code: // start of the code var clickmessage="Sorry, you don't have...
1
by: Graham J | last post by:
I submitted a variation on this on the Opera forum but I thought I'd bring it up here too as a more general HTML query. Consider this code (I've shown it the old fashioned presentational way but...
5
by: Jelks Cabaniss | last post by:
I asked this in two of the Opera newsgroups, but except for one person who advised me to just use namespaced HTML elements in my XML, there were no replies. Has anybody here successfully used...
20
by: Roberto | last post by:
Hallo, I'm building a page that wants to respect XHTML 1.0 strict and CSS2 specifics. In this page I have to present thumbnails arranged to cover the entire width of the window, but there are...
11
by: mercurius_1 | last post by:
I need some help with this page: http://www.sarahpollock.com/new/x.php I stole much of this layout from "A List Apart," but I'm no CSS guru and I desperately need some help with the finishing...
7
by: Warren Post | last post by:
I´m trying to implement a:hover popup images like Eric Meyer did at <http://meyerweb.com/eric/css/edge/popups/demo2.html>. My latest take is at...
17
by: Stian Lund | last post by:
Hello, I've been struggling with this problem for a while now, so I though I'd get some input from anyone more skilled with CSS than I am. I'm actually trying to accomplish two things with this:...
61
by: phil-news-nospam | last post by:
Why does SVG need a different tag than other images? IMHO, SVG should be implemented as an image type just like any other image type, allowing it to work with <img> tags, and ... here is the...
6
by: Ivan Bútora | last post by:
I have recently looked at http://alistapart.com/articles/imagegallery to implement a simple picture gallery on a webpage that I'm working on. Everything works fine; however, I have one question....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.