Graphics won't display locally

He has: 57 posts

Joined: Dec 2004

I've always updated my sites locally. Checking for errors and ensuring that all graphics display properly before uploading to the server.

Today however, I came across a new issue reguarding any new website graphics I add to the site.... the issue is that they will not display locally. I've even tried rebooting but it didn't work either (didn't think it would but had to try it).

Once I upload the graphics and the HTML files to the server they work fine. But why is it that all of a sudden new graphics don't display until they are uploaded to the server? All of my old graphics work just fine locally.

I've noticed that there have been a number of updates from Microsoft lately and was wondering if anyone knew whether or not this may be a factor.

Has anyone else noticed this? Does anyone know how to get the graphics to display locally?

Thanks for any feedback.

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

What is the actal SRC= for the image, is it a relative path (ie. "images/picture.jpg" or an absolute path (ie. "/images/picture.jpg" or "http://www.domain.com/images/picture.jpg)?

It is probably that you have an absolute path, therefore you cannot see it locally.

If you are using firefox to view the image, right click on where the image should be and choose "View Image" and it should show you in the location bar where it is trying to get the image from.

Myself, as the way I used directory structure and templates, I prefer everything absolute off of the root of the site ( /images/picture.jpg ) This avoids any problems when using an included template throughout many directories, which a major site I maintain does.

To be able to use this on a windows system, and still do local previews, I use the SUBST command. Here is how I set it up:

Assuming the root of the site is located in the folder:
D:\WebSites\Company.com
I will create a temporary "drive" say, W: this way:

Create a new shortcut (right click on an empty spot on your desktop, NEW ->Shortcut

For the "Location", for my example above, enter SUBST.EXE W: D:\WebSites\Company.Com

For the name, it will suggest "subst.exe", change this to something meaningful like "Company.com Drive"

Now double click on theshortcut when you want to work on your site. You will now have a drive W: that is actually the content of D:\Websites\Company.com

Now how it works:

If you have the page trying to view \images\picture.jpg , on the server it is the root of the domain, however, viewed locally, it will be trying to go off of the root of our drive. In my example, it would have tried to load D:\images\picture.jpg when in reality, the image is located at d:\WebSites\Company.com\images\picture.jpg

Now that you have a simulated drive W:, it will look for the image at W:\images\picture.jpg, where the image is actually at.

-Greg

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.