Jump to content

Is there a way?


trudat
 Share

Recommended Posts

Usually if you enter an image like this < img src = " sexy.jpg " / > it will search for the image ONLY in the same folder that the html file is in. Is there a way to code things so that it searches sub-directories as well, like an "image" folder in that directory without having to change all the image paths to < img src = " image / sexy.jpg " / > ?

Link to comment
Share on other sites

You want it to try BOTH? No. Maybe if you wanted to JavaScript involved . . . but that sounds like a hassle.
Not both. The default is the same folder as the html file is in, but isn't there a way to change the default for the whole page?
Link to comment
Share on other sites

The <base> does that for links in HTML4. I believe it does it for any element with a URL in HTML5. But (assuming I understand the spec correctly) it seems not to be one of the HTML5 features that has support yet.

Link to comment
Share on other sites

You could do it this way (assuming you can run php):At the top of each page, include a config file, and in that config file you stick a variable:$imagepath = "/path/to/images/";and then on each img src attribute, you have:<img src="<?php echo $imagepath; ?>image.jpg" alt="" />Pros and cons to that also, like anything :)

Edited by real_illusions
Link to comment
Share on other sites

You could always open the source code in Notebook, go to edit>replace and replace all img src = " sexy.jpgwith img src = " image / sexy.jpg Pretty easy to do it that way. There are also some quick and easy tricks to doing large numbers of files with different names. For example, replacingimg src = "withimg src = "image/will make every image file change to the "image/" directory. As far as what you're asking with searching two places or not having to change the directory, sounds like it would be more hassle than just keeping the files where they are.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...