IIS Local Server - Not Displaying Images Correctly

I have Win XP with IIS installed w/ PHP/MySQL. Everything works fine except that my images are not displaying correctly. You can see the images, but sometimes they look like they weren’t developed all the way. This only happens when I view the pages locally (http://localhost/example.php).

Has anyone ever had any experience with this? How do I solve this problem?

What do you mean by not developed all the way? Do you have a link or screen shot?


Here’s a mild example. Sometimes parts of the image will not be displayed all the way and there will be funky looking colors all in it. Everything looks fine when I upload it to the web server. It’s only broken up when I view it on my local testing server.

My first guess is that it’s because I’m using CSS to display the background image. Does IIS have problems w/ displaying images via CSS or are there any other issues that might cause this?

IIS hosts CSS well, and it would have nothing to do with your issues. It is due to one or more of issues with the CSS, the images and particular browsers. I am guessing you are using CSS positioning, like SitePoint preaches!

Have you tested this on multiple browsers? Have you tested loading the images individually in the browser?


Yes, I’ve tested this on multiple browsers and get the same results in both Firefox & IE. Everything shows correctly once I upload it to the main web server (Apache) and off of my local server, so that should eliminate the browsers and the CSS from being the culprit.

It’s a single image that is getting jumbled up. It’s not spliced or anything. That’s the weird part. And the other smaller images that are being called from the stylesheet display fine.

Since it’s a larger image, could it be that IIS loads the page before the image is finished being rendered from the CSS?

I’ll try splitting it into smaller parts and try loading them with CSS to see if that fixes it.

I’m working on a new site locally and this time I’m not using CSS to display the images. The images are still not displaying correctly so that rules out the CSS rendering theory.

What could be causing this?

I’d bet my bottom dollar it’s due to the graphic rendering utility. Which one do you use? PHP ships with a version of GD for example. Bu there are others like ImageMagikc and NetPBM. GD is not very good at handling graphics other than gifs. Check out your configuration and see.

Hmm… not sure if I follow.

I installed PHP Version 4.3.9 on Windows XP using IIS and am not using any PHP based functions to resize or generate the image. Only html or css. I only have this problem when I view the page on my local server. It works fine once I upload the files to any of my servers.

I didn’t see any settings in phpinfo for the graphic rendering utility. Is there a way to check on IIS?

Just wondering if you ever resolved this issue. I’m having exactly the same problem. Images work great from remote server, but are “broken” when using localhost. Look just like yours, get about halfway through, then junk for the the rest of the image. This is using Apache2.0/PHP 5.0.2 and all browsers connecting to localhost exhibit the problem: IE, Firefox, Safari. HOWEVER - if I open the images directly from the browser ( using a fileshare vs. using localhost to serve them up ) they display just fine, so there is an issue with the server being unable to serve up images to localhost properly.

Just hoping someone has a solution to this issue. Clients visiting the office like to see their pages from localhost once in awhile, and if all of the images look like crap… it just doesn’t present a professional image.

How big are your images? If you’re image is not a background image, then try slicing it up into smaller images. Doing this fixed the problem on one of my sites.

I really wished I knew what the deal was with it. It’s really annoying.

Have enabled Http compression by any chance?

Just did some testing and it’s interesting, the break is at 65K. After testing ~100 images, anything 64k or smaller worked fine, 65k was hit & miss, 66K or bigger were ALL mis-represented. 66Kish images only the bottom one-three “rows” were messed up (a “row” being the height of a character), and this extends up into the image as it gets bigger, so if you have a 120K image, about half of it will be messed up, a 180K image, about two thirds messed up, etc. Since I’m working on a landscape photography site, most of my images are 150-300K+ big, so they really look bad on localhost.

Just to note, the images themselves are fine, no errors and every “image editor” opens them fine, and if I load them from a remote host, they look fine - it’s ONLYwhen I’m viewing them from localhost AND the image is larger than 64K that I get the incorrectly rendered images. It’s almost like the browser or the server gets an “I’m done” message before the image has completed rendering… But I don’t think it’s a timing issue, otherwise the break in the images would move around a bit, and the images ALWAYS “break” in exactly the same place, every time, which leads me to believe it’s a size thing more than a timing thing…

Not sure where to check for HTTP compression settings, I’m assuming this is in the web server configs somewhere? I searched through httpd.conf for “compression” and no instances found, so… would it be in a different config file?

Yet another odd observation. I’ve been using a script called cropcanvas along with cropinterface and if I crop across, or even fully within the garbage part of the image - I actually get the correct resulting crop, as if the image were not garbage at all in that spot (as long as the crop is less than 65k - otherwise it exhibits exaclty the behavior above, the more area over 65k, the more garbage in the crop). So this tells me the image is actually represented in memory correctly, it’s just not being served to the web page, how very strange!


This is quite interesting. Can any of you that have this problem post your Windows version, list of ISAPI filters (by clicking on Web Sites -> Properites -> ISAPI filters) and configuration of you default web site. I never encountered and error like this before.

Ok, the issue was actually an Apache issue. Found this sweet tidbit of info on some other thread on the net and it worked for me, so may work for others.

From coopster at webmasterworld:

Fun one to troubleshoot, no doubt. I did find resolution though, related information from both MS and apache. To fix, I simply uncommented the following directives in my httpd.conf file:

EnableSendfile Off
EnableMMAP Off

full thread at: http://www.webmasterworld.com/forum88/4495.htm

I’m so happy!!! I could kiss coopster!!!