pics,graphics & directories

They have: 18 posts

Joined: Jun 2003

Hello, I'm making a website and trying to layout how I'm going to make it.

My question is for a highly visited site--Is it better to put pics and graphics in their own directories, or put them in the directories where they will be used?

Please keep in mind that I only know basic html--no fancy programming languages. Confused Thanks for any advice you could offer.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

It's better to put them in a logical location. Period.

i.e.
/section/images
/sitedesign/images

And refer to them as that as well -- that way you can put the images anywhere you want without worrying about finding them.

It doesn't matter how you do it as long as you are consistent.

Also, since I'm here:

Absolute by domain: domain.com/images/image.gif
Absolute / Relative to root: /images/image.gif
Relative to file: images/image.gif
Relative to file, other directory: ../images/image.gif

Of these options, the relative to root (also called absolute by some) is the most transportable and least prone to error and duplication. I would recommend it above the other choices.

They have: 18 posts

Joined: Jun 2003

Thanks Suzanne. Sticking out tongue

davidjaymz's picture

He has: 193 posts

Joined: Jul 2001

hey.... just to hijack this...
if i'm in
domain.com/blog/index...
and want to link to an image in
domain.com/images
I use ../images/image.gif

what happens if i'm deeper into a file structure? can i ../../ to get two steps back up?

Thanks for any help

DJ

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

davidjaymz wrote: hey.... just to hijack this...
if i'm in
domain.com/blog/index...
and want to link to an image in
domain.com/images
I use ../images/image.gif

what happens if i'm deeper into a file structure? can i ../../ to get two steps back up?

Thanks for any help

DJ

Sure can. Smiling

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

of course, it's easier to not get lost and just code

Then you just need to know where that image directory is, instead of where it is in relation to your file.

davidjaymz's picture

He has: 193 posts

Joined: Jul 2001

so using Quotes ".." will take me back to the root?
The reason i'm asking is because if you go to my blog (davidjaymz.com/blog) everything works and i've used (../) but if you go to blog.davidjaymz.com which is the same blog... the pages show up but no css and no images... is this due to the use of ../ to get out of directories and into other ones?

As always thanks for any and all help

DJ

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

yes -- that's why I suggest using /images/whatever as your src, it will prevent things that are in different folders getting confused, especially when you use the same file across different directories!

druagord's picture

He has: 335 posts

Joined: May 2003

no this wont work for blog.davidjaymz.com since your website root does not contain the image folder you cannot go higher up then root on a properly configured server

IF , ELSE , WHILE isn't that what life is all about

davidjaymz's picture

He has: 193 posts

Joined: Jul 2001

ok... now i am confused... LOL if blog.davidjaymz.com points to the folder davidjaymz.com/blog where does the difference occur?

as always any and all help is appreciated

DJ

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

blog.yourdomain.com is ROOT
yourdomain.com/blog is a sub-directory

The difference is in how you access it. Basically a sub-domain works like a regular domain.

If you have blog.yourdomain.com set up, and you can still access yourdomain.com/blog I would recommend that you a) make sure all your images relating to blog.yourdomain.com are in the /blog/ directory or b) you redirect all calls to yourdomain.com/blog/ to blog.yourdomain.com using the .htaccess file.

davidjaymz's picture

He has: 193 posts

Joined: Jul 2001

Sad I guess i'm gonna have to double up some of my files then... Smiling oh well... if it makes everything work it'll be cool... I'll just have to remember to copy to multiple folders...

As always thanks for the help

DJ

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.