better to use full url for images?

They have: 43 posts

Joined: Sep 2005

Hi yall,

Just wondering what's better/proper coding when using images, is it better to code the full url,

mysite.com/images/image.jpg

or just use /images/image.jpg

or does it matter?

Busy's picture

He has: 6,151 posts

Joined: May 2001

just folder and name as the full path makes the browser pop out of your domain and back in again which slows the loading down by nano seconds (hey thats a lot if your a nano or something).
Another reason not to use the full path is if you ever change domain names and/or web hosts (and it happens), having used the full path you'd have to edit every single mention of it in every single one of your sites pages, where as just using the folder/name option doesn't require any changes, unless of course you change the folder name.

They have: 43 posts

Joined: Sep 2005

Thanks, makes perfect sense! Especially about changing domains - my site will eventually have hundreds of manually created pages by different people, so there wouldn't be an easy way to edit all of them to reflect a new file structure, or new domain either. Thanks Busy Cheers!

Oh and I gotta quick question: should I include a slash in front of the images folder name?

-or-

He has: 698 posts

Joined: Jul 2005

It's only necessary to include a slash in front of the folder name if the file you are editing is not in the root folder of your website.

Also, you have to make sure, when you do that, that your images folder is in the root folder. (e.g. http://yoursite.com/images)

Kurtis

They have: 43 posts

Joined: Sep 2005

Oh, I didn't know that - thanks mscreashuns. Laughing out loud

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.