Forum Moderators: open

Message Too Old, No Replies

PNG Image not displaying in Mozilla

Works fine in XHTML <img src="my.png"> tag

         

coopster

3:58 pm on Dec 19, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I have PNG images which I display using the XHTML <img> tag. All works fine with browsers tested. However, with Mozilla based-browsers like NN7.1 and Firebird, I have an issue. Whenever I right-click and 'View Image' the window opens and displays (garbled) text. The same is true if I simply click the link while viewing the directory in a browser. IE6 handles this OK and displays the image. Anybody else run into this and if so, what do I need to do to get this functioning as IE6 handles it?

davidpbrown

4:06 pm on Dec 19, 2003 (gmt 0)

10+ Year Member



Should it not be <img src="my.png" />?

choster

4:06 pm on Dec 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I would guess that the MIME type is incorrectly set on your server, so the PNG is being interpreted as text instead of an image. Ask your host to make sure .png is associated with the type image/x-png.

IE will make assumptions about how to display content based on your local Windows settings, whereas other browsers obey the content type specified by the server.

coopster

5:23 pm on Dec 19, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



davidpbrown, yes, the <img> tag is terminated correctly. All of my empty tags end with
/>
. Ahh, you're talking about the meta description I keyed as invalid XHTML. Yeah, that was just a test to keep you on your toes over here in HTML and Browsers. -- smart aleck ;)

choster, I tried that. I dropped a per-directory access control directive in there to see if that was the issue:


AddType image/png png
AddType image/x-png png

but to no avail. The image is coming through as MIME type
image/png
. The browser(s) still won't render the image -- like I stated earlier, they render the image correctly in the XHTML, but as soon as you try to view the image outside of that the problem occurs.

ergophobe

5:44 pm on Dec 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



coopster,

What do you see when you look under "page info" ¦ "media"? Do they images render?

davidpbrown

9:45 pm on Dec 19, 2003 (gmt 0)

10+ Year Member



:) wasn't trying to be clever, just to avoid the obvious.

Another obvious suggestion.. see Mozilla's bug tracking system
ht*ps://bugzilla.redhat.com/bugzilla/index.cgi
searching 'png' draws 84 bugs including 3990 and 20018 talking of core dumps and corrupted images and konqueror + image preview = crash.

2cents

coopster

7:52 pm on Dec 20, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>>wasn't trying to be clever, just to avoid the obvious

I realized that. I didn't copy the meta description for the thread out of my code -- I keyed it (incorrectly) and you caught me. I was trying to be clever afterward, having a bit of fun with it. I don't really think you are a smart aleck. I think you are a smart davidpbrown :)

I will check those bug reports and see if anything turns up. I'm not sure it is a bug though, as the PNG image will render correctly when the correct MIME-type has been requested and sent, as is the case when the image is viewed in my XHTML via the <img> tag. I keep wanting to go back to MIME-type and figure it out from that angle. I did read a bit on the imagelib [mozilla.org] responsible for the decoding and display of images and now I feel it has to be a MIME-type issue.

There is one correction here. In msg #4 I stated that...

The image is coming through as MIME type
image/png
.

...which is incorrect. Yes, it is coming through that way in the XHTML <img> page, but not when I View Image. During View Image the MIME type is
text/plain
. And nothing is being reported in the media tab, ergophobe. I would expect the AddType directives I described in msg #4 to correct this issue.


Update
As I was responding to this thread I decided to FTP the same exact images to a different server and guess what?
Images are rendering as expected!
image/png
!
Even when I View Image!

choster's speculation was on target. I now have resolution. All I needed was an AddType directive as the MIME type was not being served as expected on the client's shared server:


AddType image/png png

Yes, I had already tried this as stated earlier. However, and this is the kicker, a simple refresh in the browser didn't do. I had to clear the browser's cache (I accessed from a different workstation on my network and all worked fine -- that was my first clue). Man, after all that, it was simply a browser-caching issue!