bcfantasy Posted February 3, 2007 Share Posted February 3, 2007 I need to know how to display an image that is located in a different folder than the one my webpage is in. For example, say I want to display image1.jpg on sample.php. I store my images in mysite.com/images and the sample.php is located at mysite.com/very/deeply/buried/webpage/sample.php , how do I display image1.jpg? I realize I could use <img src="http://www.mysite.com/images/image1.jpg"> Is there a better/easier way? Quote Link to comment Share on other sites More sharing options...
twilightnights Posted February 4, 2007 Share Posted February 4, 2007 you can do it 2 ways, relative to the path you are in, or an absolute path which you have shown. To go up a directory you use ../../../etc check out http://codepunk.hardwar.org.uk/bhtmlx12.htm Quote Link to comment Share on other sites More sharing options...
FierceBlade Posted February 4, 2007 Share Posted February 4, 2007 Like twilight said it would be <a href='../image1.jpg'> this goes back a directory, <a href='.../image1.jpg'> this goes back to your first directory that everything is located. So it would be as if: http://www.mysite.com/image1.jpg Quote Link to comment Share on other sites More sharing options...
bcfantasy Posted February 4, 2007 Author Share Posted February 4, 2007 Thanks for both of the replies. I hadn't seen the ... before, but I think that's what I want. Especially if I ever decide to move the page. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.