Ezilon.com - Target Your Audience, be Seen in Your Region

better to use full url for images?

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.

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
Modrater

He has: 6,149 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.

<?bhb if(broken){ echo("It wasn't me Smiling "); } ?>
Learn HTML the ez way - EzHTML.net

Some people are like slinkies, they dont really serve any purpose but they still bring a smile to your face when you push them down the stairs ...

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-

mscreashuns's picture

He has: 560 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)

They have: 43 posts

Joined: Sep 2005

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