Howdy folks, I don't see the attached images in Google Chrome when I view forum posts. If I use Firefox, I can see the images. It looks like the reason is that the images aren't complying with the HTTP spec and Firefox is a little more lenient than Google Chrome.
The problem lies in two response headers that the server responds with:
The problem is that the content length of the response when gzipped is actually 127404 bytes, but the content-length header is always sending down the length of the non-gzipped image. So Google Chrome (and probably other browers) are expecting more data than the server sends so they think the request got interrupted and don't display the image.
I don't know the details of the site, but often there's not a huge gain from gzipping images like jpg and png since they are already compressed. It may be okay to disable gzip compression for those file types. Otherwise, the fix would be to make sure the Content-Length header matches that actual content length that the server is responding with (127404 in this case).
Here's how I tested this on Linux:
View the size of /tmp/foo.jpg.gz (127404 bytes), then view the first few lines in /tmp/foo.txt to see that it is sending a content-length of 127515 bytes which is larger than the size of /tmp/foo.jpg.gz. If you gunzip /tmp/foo.jpg.gz you'll see that it now matches the incorrect content-length header.
posted 8 years ago
Thanks for posting this! I joined the site today and was wondering why I can't see any images. I'm also using Chrome.