Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

purduematt

macrumors newbie
Original poster
Jul 17, 2002
29
0
i have a few webpages located in the folder:

/users/matt/sites/folder1/

and would like to use a picture from the foler

/users/matt/sites/images/

i have tried the following with no luck:

<img src="/images/picture.gif">

and

<img src="../images/picture.gif">

could somebody tell me what i am doing wrong? i think it isprobably something simple, i just couldn't figure it out. thanks,

matt
 
I don't know the right answer, but you could put an alias to the pictures you want to use in the sites folder and just access that. Just a thought.
 
Don't put the / in front of it. If you do, you're designating an absolute pathname which tells the computer where to look from the root level of your HD, not the current directory being used.

pnw
 
i thought that when you put / in it refered to the site root, not the absolute pathname from the computer. i may be wrong.

i also tried

<img src="/users/matt/sites/images/picture1.jpg">

and

<img src="images/picture1.jpg">

with no luck

i am not sure why this is not working. maybe i have to have the pictures in the same folder, or below the webpage in the file system
 
Originally posted by purduematt
i thought that when you put / in it refered to the site root, not the absolute pathname from the computer. i may be wrong.

i also tried

<img src="/users/matt/sites/images/picture1.jpg">

and

<img src="images/picture1.jpg">

with no luck

i am not sure why this is not working. maybe i have to have the pictures in the same folder, or below the webpage in the file system


try:
<img src="/~matt/images/picture1.jpg">, and see how that works
 
Okay, it tells the server where to find the images thare are being accessed, on the server. Try this: Open the "Get Info" window on your Sites folder, open the Permissions tab, and click "copy to enclosed items" or whatever it is-- the Images folder may not be accessible in the same way as stuff in the Sites folder--

it's hung me up once or twice...

pnw
 
To use a relative path, use the "../" notation to go up a directory.

For instance, when you're in a page within /Users/matt/Sites/folder1/ and you need to get back to /Users/matt/Sites/images/picture.gif, use the following code:
PHP:
<img src="../images/picture.gif">
The path will go up one from "folder1" and then into "images" to get the file.

[edit: Jimong5's code above should work, too.]
 
thanks for the help everybody. it looks like it was a permissions problem. after performing paulwhannel's suggestion everything worked as normal.

thanks again,

matt
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.