Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/editor/ImageViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ define(function (require, exports, module) {
ProjectManager = require("project/ProjectManager"),
Strings = require("strings"),
StringUtils = require("utils/StringUtils"),
FileSystem = require("filesystem/FileSystem");
FileSystem = require("filesystem/FileSystem"),
FileUtils = require("file/FileUtils");

var _naturalWidth = 0,
_scale = 100,
Expand Down Expand Up @@ -312,7 +313,11 @@ define(function (require, exports, module) {
$("#img-preview").on("load", function () {
// add dimensions and size
_naturalWidth = this.naturalWidth;
var ext = FileUtils.getFileExtension(fullPath);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a better approach to get the file extension (maybe passed through)?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line seems reasonable to me. It's not going to be a performance bottleneck, if that's the concern...

var dimensionString = _naturalWidth + " × " + this.naturalHeight + " " + Strings.UNIT_PIXELS;
if (ext === "ico") {
dimensionString += " (" + Strings.IMAGE_VIEWER_LARGEST_ICON + ")";
}
// get image size
var file = FileSystem.getFileForPath(fullPath);
var minimumPixels = 20; // for showing crosshair cursor
Expand Down
2 changes: 1 addition & 1 deletion src/language/languages.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@

"image": {
"name": "Image",
"fileExtensions": ["gif", "png", "jpe", "jpeg", "jpg"],
"fileExtensions": ["gif", "png", "jpe", "jpeg", "jpg", "ico"],
"isBinary": true
},

Expand Down
3 changes: 3 additions & 0 deletions src/nls/root/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,9 @@ define({
"INLINE_EDITOR_NO_MATCHES" : "No matches available.",
"CSS_QUICK_EDIT_NO_MATCHES" : "There are no existing CSS rules that match your selection.<br> Click \"New Rule\" to create one.",
"CSS_QUICK_EDIT_NO_STYLESHEETS" : "There are no stylesheets in your project.<br>Create one to add CSS rules.",

// Custom Viewers
"IMAGE_VIEWER_LARGEST_ICON" : "largest",

/**
* Unit names
Expand Down