Images are not displayed

Aug 16, 2009 at 4:52 AM
Edited Aug 16, 2009 at 4:53 AM

I updated to 1.5 on my local development box today and now none of the images in my blog are displayed anymore. I then downloaded the 1.3 version from the live server to the local server and the same thing is happening with 1.3, too. The exact copy on the live server works just fine.

Any ideas what could be going on here?

Thanks

Coordinator
Aug 16, 2009 at 9:42 AM

Not sure, but are you using the latest web.config file that comes with BE 1.5?  What version of IIS are you using?

If you're using an older version of the web.config file and IIS7 is the web server, the image handler (image.axd) may not be configured correctly.

Can you pull up the RSS feed?

Coordinator
Aug 16, 2009 at 10:03 AM

Also, if you right click on one of the images that isn't coming up and get the URL to the image (or get the URL to the image via your browser's View Source), try navigating directly to the image via the URL.  See what comes up.  There could be a helpful error message, for example.

Aug 16, 2009 at 8:30 PM
Edited Aug 16, 2009 at 8:31 PM

Thanks. Looks like something is wrong with the image handler. Navigating directly to the image gives:

 

The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, 
had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it
is spelled correctly. Requested URL: /image.axd

 

I'm running IIS 5.1 on Windows XP locally. I think the live site is hosted on IIS7. I'm using the web.config straight from the installation for the BE 1.5 site, and for the BE 1.3 site a copy of the web.config file coming from the live server. So it looks like the web.config works with IIS 7 but not with IIS 5.1.

What do I need to do to make BE work with IIS 5.1 again?

Coordinator
Aug 16, 2009 at 11:04 PM

On your local machine, is the blog installed directly in 'localhost', or is it installed in an application folder (e.g. BLOG)?  In other words, what is the URL to the blog's homepage?  And what is the URL to the image.axd file?

Did you copy over pre-existing blog posts from the live server to your local machine?

I'm guessing that on the live server, the blog is installed in the root of the website.  If you have your blog installed on your local machine also in the root "localhost" folder, the URL to the images should be the same as they are on the live server.

However, if you have the blog installed on your local machine in an 'application' folder, such as:

http://localhost/blog/

Then the URL to image.axd is probably not matching what it is on your live server.

If this is the case, try creating a new blog post on your local machine, and include an image in the new blog post to see if it works.

If your blog is installed in a folder (e.g. BLOG) on your local machine, then the following path to image.axd won't work.

/image.axd?picture=....

The URL would instead need to be:

/blog/image.axd?picture=....

So, I'm saying that the image.axd handler probably does work, but the path to it isn't the same on your local machine as it is on the live server.  In this case, images for pre-existing posts you copied over from the live server won't work unless you manually change the path to image.axd in each of the blog posts.

Aug 17, 2009 at 3:31 AM

You are correct. On my local machine the blog is located at http://localhost/blog13.

So where do I change the path to image.axd?

 

Coordinator
Aug 17, 2009 at 5:44 AM

Unfortunately, there's not a single place to change it.

If your posts are stored in the App_Data folder (rather than the DB), the posts will be in the App_Data\posts folder.  There will be a single XML file for each post.  The image tag is in the post <content> tag.  So you would want to do a search and replace of the content in the <content> tag.  Replace /image.axd with /blog13/image.axd.

If your posts are stored in a database, similar procedure.  The post content will be a column named PostContent (or similar, don't remember exactly).  You would want to run an UPDATE statement on this column to replace /image.axd with /blog13/image.axd.

Another, cleaner way to do it would be to create C# code that goes through all the posts and updates the Content.  Something like this:

foreach (Post p in Post.Posts)
{
    if (p.Content.IndexOf("/image.axd", StringComparison.OrdinalIgnoreCase) != -1)
    {
        p.Content = p.Content.Replace("/image.axd", "/blog13/image.axd");
        p.Save();
    }
}

Oct 21, 2009 at 6:21 PM
Edited Oct 21, 2009 at 6:35 PM

The another scenario for this issue is, When you restrict to show specific no of characters in description of the post. You can control/do this on "Settings" page.

Thanks,

NRK