Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
340a227
commit 15fc28d
Showing
4 changed files
with
44 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Notes: | ||
|
||
Determines the size of an image: | ||
<script> | ||
function onImageLoad(aEvent) { | ||
alert("width:" + aEvent.target.width + "\nheight:" + aEvent.target.height); | ||
} | ||
|
||
var img = document.createElementNS("http://www.w3.org/1999/xhtml","html:img"); | ||
img.addEventListener("load", onImageLoad, false); | ||
img.src = "http://upload.wikimedia.org/wikipedia/commons/0/06/Gigantactis.jpg"; | ||
</script> | ||
|
||
OR largest image on the page: | ||
|
||
<script> | ||
var sHTML = getHTMLSomehow(sURL); | ||
var nMaxDim = 0; | ||
var $pageDOM = $(sHTML); | ||
var $objMaxDimImage; | ||
|
||
$pageDOM.("img").each(function(){ | ||
var $this = $(this); | ||
var nDim = parseFloat($this.width()) * parseFloat($(this).height()); | ||
if (nDim > nMaxDim){ | ||
$objMaxDimImage = $this; | ||
nMaxDim = nDim | ||
} | ||
}); | ||
|
||
alert("Max dim is:" nMaxDim); | ||
alert("Image Source:" $objMaxDimImage.attr("src")); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters