Click here to get back home

Can't Access Image Above Project Root

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Can't Access Image Above Project Root pbd22 02-25-2008
Posted by pbd22 on February 25, 2008, 10:30 am
Please log in for more thread options
Hi.

I need to do this:

I can't access image folders that are above my project's root
in the folder hierarchy. So, I want to do the following but
it doesn't work:

<img alt='image' style="height:200px; width:200px;" src="../images/
image.jpg" />

Inetput
|
|
wwwroot
|
----images/image.jpg
|
----Project/


This does work:

<img alt='image' style="height:200px; width:200px;" src="images/
image.jpg" />

Inetput
|
|
wwwroot
|
|
----Project/images/image.jpg

I can see the image in Design view but when i run the project I only
see the alt tag, not the image.
I can see the image when the file is in the projects directory, but
not above it.

Any ideas??

Thanks

Posted by Rik Wasmus on February 25, 2008, 11:06 am
Please log in for more thread options
> I can't access image folders that are above my project's root
> in the folder hierarchy. So, I want to do the following but
> it doesn't work:
>
> <img alt=3D'image' style=3D"height:200px; width:200px;" src=3D"../imag=
es/
> image.jpg" />
>
> Inetput
> wwwroot
> ----images/image.jpg
> ----Project/
>
> This does work:
> <img alt=3D'image' style=3D"height:200px; width:200px;" src=3D"images/=

> image.jpg" />
> Inetput
> wwwroot
> ----Project/images/image.jpg
>
> I can see the image in Design view but when i run the project I only
> see the alt tag, not the image.

I take it the Design view uses the filesystem rather then a webserver?

> I can see the image when the file is in the projects directory, but
> not above it.

What's the URL of the actual page you are watching? Is it =

www.example.com/Project/andthensomething.html, or what? Keep in mind the=
=

url should be a valid 'path' considered from the browsers point of view,=
=

NOT the servers.
-- =

Rik Wasmus

Posted by pbd22 on February 25, 2008, 11:54 am
Please log in for more thread options
Thanks Rik.

Well, I think the idea is to use "relative paths". The browser is an
application that will be loaded on several servers at various
locations so, its better to do something like "../path/to/image.jpg"
than use a URL or and IP which changes from box to box.

> What's the URL of the actual page you are watching?

So, havening said that, the URL (not public) is
http://www.domain.com/presentation.aspx
And, inside presentation.aspx is an iframe that has src=slides.htm.
Inside slides.html is the image tag that looks for an image in a
sibling folder to the root folder.

> url should be a valid 'path' considered from the browsers point of view, NOT
the servers.

I think I am doing that correctly. And, as far as i understand, the
below image:

<img src="../folder/image.jpg" alt="img" />

should expose an image in a folder named "folder" that is a sibling to
the web site's root folder.

Peter

Posted by Rik Wasmus on February 25, 2008, 12:07 pm
Please log in for more thread options

> Thanks Rik.
>
> Well, I think the idea is to use "relative paths".

Well, duh.

> The browser is an
> application that will be loaded on several servers at various
> locations so, its better to do something like "../path/to/image.jpg"
> than use a URL or and IP which changes from box to box.

Yes, but if a page is http://project.example.com/index.html, having a =

relative URL like '../images/foo.jpg' doesn't do you any good, as =

allthough it may seem a valid path on the server, a browser doesn't =

request relative urls from the server, it translates them and uses a ful=
ly =

qualified url. In the example, there is no path above =

http://project.example.com... Would you have had =

http://www.example.com/foo/bar.html, with a src attribute like =

'../images/foz.jpg', the browser requests =

'http://www.example.com/images/foz.jpg', NOT '../images/foz.jpg'.

>> What's the URL of the actual page you are watching?
>
> So, havening said that, the URL (not public) is =

> http://www.domain.com/presentation.aspx

example.com is reserved for those purposes. Here, from s browsers point =
of =

view, there is clearly no path above it.

> And, inside presentation.aspx is an iframe that has src=3Dslides.htm.
> Inside slides.html is the image tag that looks for an image in a
> sibling folder to the root folder.
>
>> url should be a valid 'path' considered from the browsers point of =

>> view, NOT the servers.
>
> I think I am doing that correctly. And, as far as i understand, the
> below image:
>
> <img src=3D"../folder/image.jpg" alt=3D"img" />
>
> should expose an image in a folder named "folder" that is a sibling to=

> the web site's root folder.

Nope, you can't go outside the root folder (you can offcourse serve file=
s =

outside the root folder using some scripts on the server, that's beside =
=

the point though), the browser MUST have a 'reachable' destination. The =
=

browser doesn't know lick about your filesystem, and can't examine it. =

Having the path 'http://www.example.com/', there's no logical way a =

browser can select a directory above that, or even guess at how to acces=
s =

it.
-- =

Rik Wasmus

Similar ThreadsPosted
Photo Album Project January 1, 2006, 8:41 pm
Teenage Web Designers Needed For Big Project February 19, 2005, 5:56 pm
Cooperative Website Translation Project June 19, 2005, 5:07 am
Can we use both Dremwever and Fronpage in a web design project? April 3, 2006, 11:47 pm
Re: Help Finding a Good eCommerce and Project Book December 1, 2004, 5:02 am
Questionnaire about item layouts for uni project website June 26, 2007, 8:03 pm
Root element specified by DTD ? June 2, 2006, 5:16 am
open source PHP/MySql project desperate for volunteers September 26, 2004, 7:34 pm
Any downside to root-relative paths? October 10, 2007, 5:52 am
Searching for HTML Editor/Tool with integrated file/project-management features August 8, 2006, 4:16 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap