Closed Bug 241274 Opened 20 years ago Closed 18 years ago

Image properties for resized images show shrunk dimensions instead of the actual ones

Categories

(Firefox :: General, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: wira_damis, Assigned: florian)

References

Details

Attachments

(1 file, 3 obsolete files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040207 Firefox/0.8
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040207 Firefox/0.8

The "Image Properties" dialog show the dimensions of the shrunk image instead of
the actual width and height. If you stretch the image to its actual size, the
dialog will show the actual dimensions.

Reproducible: Always
Steps to Reproduce:
1. Open an image that will be automatically resized to fit the browser window
2. Context menu -> Image properties
3. Look at the dimensions

Actual Results:  
The image properties dialog show the shrunk dimensions instead of the actual one.

Expected Results:  
The dialog should show the actual dimensions no matter what.
If I have an image in a web page that says:

  <img src="whatever" height="100" width="100">

then what should image properties show?

More precisely, are we showing the properties of the image node, or of the image
itself?
Would it be difficult to show both?  Example:
Image dimensions: 1024x1024
Displayed size: 500x500
My original intent when I filed this bug was just for a shrunk image when it's
viewed by itself in a browser window. Now that you raised the issue whether the
browser should display the dimensions as it is specified by the author of the
page or to show its actual dimensions, I don't know.

Suggestion in comment #2 can work.

If the displayed dimensions are the same with the actual dimensions, the browser
can just show one set of width/height information.
> Would it be difficult to show both?

Not really.  See nsIImageLoadingContent; you can get the imgIRequest and get the
image object and its sizes off of that.

> just for a shrunk image when it's viewed by itself

It's identical to the case I bring up in comment 1 -- that's how it's
implemented internally.
Well, I dont think displaying both will clutter the interface much.

Anybody willing to code this?
/voting for this bug/
I don't understand bz's comment from comment 4 but I noticed in DOM Inspector
there are two properites called natural(Height|Width) that seem to give the
values we are looking for.  Are there any reasons why those properties would not
work?
OS: Linux → All
Hardware: PC → All
*** Bug 256433 has been marked as a duplicate of this bug. ***
I already reported this as a duplicate bug...
Quite some people told me about this... 

I think the best solution is the one showing both sizes, the actual size and the
resized size...

Confirming bug.
Status: UNCONFIRMED → NEW
Ever confirmed: true
I was looking for quite some time into which Category to reassign this bug...
But I failed to come up with a good choice... 

The bug has much more chance to be fixed if filed in another Category than
"Browser-General"... 

Changing severity from trivial to enhancement.
Severity: trivial → enhancement
Product: Browser → Seamonkey
Enhancement?  Firefox is giving out misleading information and trust me, people are getting confused.
*** Bug 270818 has been marked as a duplicate of this bug. ***
==> XP Apps: GUI
Assignee: general → guifeatures
Component: General → XP Apps: GUI Features
QA Contact: general
Attached patch patch-firefox v1 (obsolete) — Splinter Review
This patch is also for bug 207372. I may make a Seamonkey version of the patch later.
Assignee: guifeatures → f.qu
Status: NEW → ASSIGNED
Attachment #243939 - Flags: review?(mano)
Comment on attachment 243939 [details] [diff] [review]
patch-firefox v1

Needs ui-r first (flag is available in the Fx product).
Attachment #243939 - Flags: review?(mano)
Component: XP Apps: GUI Features → General
Product: Mozilla Application Suite → Firefox
Attachment #243939 - Flags: ui-review?(mconnor)
Attachment #243939 - Flags: ui-review?(mconnor) → ui-review?(beltzner)
Comment on attachment 243939 [details] [diff] [review]
patch-firefox v1

Physical size is the wrong string here. I preferred CTho's proposal in comment 2, which would make the labels:

Image Dimensions:
Displayed Size  :

Better yet, if the image is displayed at a size different than the dimensions, it would be useful to just mention that inline like:

Image Dimensions: 1024px x 768px (scaled to 800px x 600px)

But that might be hard to do with L10N and RTL requirements, dunno.
Attachment #243939 - Flags: ui-review?(beltzner) → ui-review-
Attached patch patch-firefox v2 (obsolete) — Splinter Review
updated patch
Attachment #243939 - Attachment is obsolete: true
Attachment #244136 - Flags: ui-review?(beltzner)
Comment on attachment 244136 [details] [diff] [review]
patch-firefox v2

Gets my ui-r, but to my untrained eye, this might not be the way that we'd want to implement the patch. That I leave to the smarter people!
Attachment #244136 - Flags: ui-review?(beltzner) → ui-review+
Attachment #244136 - Flags: review?(mano)
Comment on attachment 244136 [details] [diff] [review]
patch-firefox v2

>Index: browser/base/content/metaData.js
>===================================================================

>+    if (img.width) {
>+      if (img.naturalWidth && (img.naturalWidth != img.width || img.naturalHeight != img.height))

Why is |if (img.naturalWidth)| needed?

r=mano otherwise.
Attachment #244136 - Flags: review?(mano) → review+
Attached patch patch-firefox v3 (obsolete) — Splinter Review
(In reply to comment #18)
[...]
> Why is |if (img.naturalWidth)| needed?
> 

Because naturalWidth is only in the HTMLImageElement object, so my previous patch works only for img tags. Now I understand comment 4.
Attachment #244136 - Attachment is obsolete: true
Attachment #244319 - Flags: review?(mano)
oups, wrong patch, sorry.
Attachment #244319 - Attachment is obsolete: true
Attachment #244321 - Flags: review?(mano)
Attachment #244319 - Flags: review?(mano)
Comment on attachment 244321 [details] [diff] [review]
patch-firefox v3 bis

r=mano
Attachment #244321 - Flags: review?(mano) → review+
Whiteboard: [checkin needed]
Checked in by request:

Checking in browser/base/content/metaData.js;
/cvsroot/mozilla/browser/base/content/metaData.js,v  <--  metaData.js
new revision: 1.11; previous revision: 1.10
done
Checking in browser/base/content/metaData.xul;
/cvsroot/mozilla/browser/base/content/metaData.xul,v  <--  metaData.xul
new revision: 1.4; previous revision: 1.3
done
Checking in browser/locales/en-US/chrome/browser/metaData.dtd;
/cvsroot/mozilla/browser/locales/en-US/chrome/browser/metaData.dtd,v  <--  metaData.dtd
new revision: 1.4; previous revision: 1.3
done
Checking in browser/locales/en-US/chrome/browser/metaData.properties;
/cvsroot/mozilla/browser/locales/en-US/chrome/browser/metaData.properties,v  <--  metaData.properties
new revision: 1.3; previous revision: 1.2
done

Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Whiteboard: [checkin needed]
*** Bug 285301 has been marked as a duplicate of this bug. ***
Depends on: 367655
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: