Closed Bug 47891 Opened 26 years ago Closed 25 years ago

View image - image type in title bar based on file extension

Categories

(Core :: Graphics: ImageLib, defect, P3)

defect

Tracking

()

VERIFIED FIXED
mozilla1.0

People

(Reporter: dave532, Assigned: attinasi)

References

()

Details

Attachments

(1 file)

When you view an image in Mozilla you'll see something like the following in the titlebar: "GIF Image 256x128 pixels" however the description of the image type seems to have been obtained from the files extension rather than the images mime-type. So if you view a JPEG image with a .jpg extension you get "JPG Image ...." or more worringly if you view a CGI script that automatically generates the images and the script has the .cgi extension you've now got a "CGI Image...". In theory you could set up your web server to assoicate .png files with the image/gif mime type and serve GIF's with a .png extension and Mozilla would claim they are PNG images when you try and view them. Steps to reproduce: 1. Load an image, note the extension to the images filename What happened: 1. Mozilla displays the image type in the titlebar based on the file extension converted to uppercase e.g. GIF, JPG, PNG, CGI, etc. What should happen: 1. Mozilla should use the images mime type to find out what type of image it is and display its type appropriately in the titlebar. Platforms tested on: Win32 (classic skin) 2000080420 MacOS9 (classic skin) a recent M18 nightly Aug 7 and Win32 (modern skin) as above (not that I really expected a skin change would matter) I'll attach an image to this bug report so you can see the "CGI Image" type ;)
over to imagelib
Assignee: asa → pnunn
Component: Browser-General → ImageLib
QA Contact: doronr → elig
Status: NEW → ASSIGNED
Target Milestone: --- → Future
As a quick hack you could always just remove the image type from the titlebar so that it just says "Image 666x888 pixels - Mozilla"
*** Bug 51038 has been marked as a duplicate of this bug. ***
It would be fairly easy to just comment out the part that asked for file extension. http://lxr.mozilla.org/seamonkey/source/layout/html/document/src/nsImageDocument .cpp#383 Also, I think you could get the MIME type (i.e. "image/gif") from nsIChannel.contentType from the channel in ImageListener::OnStartRequest, reformat it ("GIF") and then pass it in to nsImageDocument::UpdateTitle. This text needs to be localized too...
*** Bug 60327 has been marked as a duplicate of this bug. ***
I think attinasi had plans to fix this (or someone in the GFX group) over to him.
Assignee: pnunn → attinasi
Status: ASSIGNED → NEW
Status: NEW → ASSIGNED
Yea, I implemented the title for the ImageDocument but at that time nobody could tell me how to find out the 'real' image type text, so I just used the extension (note the comments in nsImageDocument::UpdateTitle. I'd like nsIImage to just provide the image type, as a (localized) string. Presumably the Image encapsulation would know the type, even if it was a user-installed image type. Futzing with the MIME type seems to break the encapsulation of the image that nsIImage attempts to provide.
QA Contact: elig → tpreston
Keywords: mozilla1.0
Nominating for mozilla1.0 - I think this but should be fixed before the 1.0 release because it can convey incorrect information to the user. At the very least the image type should be removed so it just says "Image (size)" rather than try and guess the filetype based on extension.
I agree that the extension should be removed, and I'll also continue trying to figure out how to get the real image type... Here is a patch to remove the extension: Index: nsImageDocument.cpp =================================================================== RCS file: /cvsroot/mozilla/layout/html/document/src/nsImageDocument.cpp,v retrieving revision 1.49 diff -u -r1.49 nsImageDocument.cpp --- nsImageDocument.cpp 2000/07/20 01:47:55 1.49 +++ nsImageDocument.cpp 2001/01/02 18:44:24 @@ -375,6 +375,7 @@ { nsString titleStr; +#ifdef USE_EXTENSION_FOR_TYPE // XXX TEMPORARY XXX // We want to display the image type, however there is no way to right now // so instead we just get the image-extension @@ -393,6 +394,8 @@ } NS_IF_RELEASE(pURL); } +#endif // USE_EXTENSION_FOR_TYPE + // append the image information... titleStr.AppendWithConversion( " Image" ); if (mImageRequest) { I'm filing an enhancement request to get the original image type into nsIImage
Target Milestone: Future → mozilla1.0
RFE for image type in nsIImage is bug 64096
sr=buster
r=dcone
Fixed: nsImageDocument.cpp
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Verified Windows 2001010904 Verified Mac 20010109008 Verified Linux 2001010908
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: