Bug 241274 - Image properties should show actual dimensions, not shrunken ones. Patch by Florian Qu�ze <f.qu@queze.net>, r=mano, ui-r=beltzner.

This commit is contained in:
kjh-5727%comcast.net 2006-11-05 19:50:59 +00:00
Родитель 9cbd6a6c01
Коммит e42d9ee08e
4 изменённых файлов: 31 добавлений и 17 удалений

Просмотреть файл

@ -58,6 +58,9 @@ var onTable = false;
var onTitle = false;
var onLang = false;
// Interface for image loading content
const nsIImageLoadingContent = Components.interfaces.nsIImageLoadingContent;
const nsICacheService = Components.interfaces.nsICacheService;
const cacheService = Components.classes["@mozilla.org/network/cache-service;1"]
.getService(nsICacheService);
@ -251,14 +254,25 @@ function checkForImage(elem, htmllocalname)
} else {
setInfo("image-filesize", gMetadataBundle.getString("imageSizeUnknown"));
}
if ("width" in img && img.width != "") {
setInfo("image-width", gMetadataBundle.getFormattedString("imageWidth", [ img.width ]));
setInfo("image-height", gMetadataBundle.getFormattedString("imageHeight", [ img.height ]));
}
else {
setInfo("image-width", "");
setInfo("image-height", "");
var imageRequest = img.QueryInterface(nsIImageLoadingContent)
.getRequest(nsIImageLoadingContent.CURRENT_REQUEST);
if (imageRequest)
setInfo("image-type", imageRequest.mimeType);
else
setInfo("image-type", "");
var imageSize = "";
if (img.width) {
if (imageRequest && (imageRequest.image.width != img.width ||
imageRequest.image.height != img.height))
imageSize = gMetadataBundle.getFormattedString("imageDimensionsScaled",
[imageRequest.image.width, imageRequest.image.height,
img.width, img.height]);
else
imageSize = gMetadataBundle.getFormattedString("imageDimensions", [img.width, img.height]);
}
setInfo("image-size", imageSize);
if (imgType == "img") {
setInfo("image-desc", img.longDesc);

Просмотреть файл

@ -127,15 +127,15 @@
<label value="&image-url.label; "/>
<textbox readonly="true" id="image-url-text"/>
</row>
<row id="image-width">
<row id="image-type">
<separator orient="vertical"/>
<label value="&image-width.label; "/>
<textbox readonly="true" id="image-width-text"/>
<label value="&image-type.label; "/>
<textbox readonly="true" id="image-type-text"/>
</row>
<row id="image-height">
<row id="image-size">
<separator orient="vertical"/>
<label value="&image-height.label; "/>
<textbox readonly="true" id="image-height-text"/>
<label value="&image-size.label; "/>
<textbox readonly="true" id="image-size-text"/>
</row>
<row id="image-filesize">
<separator orient="vertical"/>

Просмотреть файл

@ -3,10 +3,10 @@
<!ENTITY caption.label "Element Properties">
<!ENTITY image-sec.label "Image Properties">
<!ENTITY image-url.label "Location:">
<!ENTITY image-type.label "Type:">
<!ENTITY image-desc.label "Description:">
<!ENTITY image-alt.label "Alternate text:">
<!ENTITY image-width.label "Width:">
<!ENTITY image-height.label "Height:">
<!ENTITY image-size.label "Image Dimensions:">
<!ENTITY image-filesize.label "Size of File:">
<!ENTITY insdel-sec.label "Insert/Delete Properties">
<!ENTITY insdel-cite.label "Info:">

Просмотреть файл

@ -8,8 +8,8 @@ altTextMissing=Missing
altTextBlank=Blank
imageSize=%S KB (%S bytes)
imageSizeUnknown=Unknown (not cached)
imageWidth=%Spx
imageHeight=%Spx
imageDimensions=%Spx \u00D7 %Spx
imageDimensionsScaled=%Spx \u00D7 %Spx (scaled to %Spx \u00D7 %Spx)
# LOCALIZATION NOTE: Next two strings are for language name representations
# %1$S = language name, %2$S = region name
languageRegionFormat=%1$S (%2$S)