Source code for bookmarklet Fixed Image Size.
javascript:
(function(){
function cE(a)
{
var a2 = [];
for (var k = 0; k < a.length; ++k) {
a2.push(a[k]);
}
return a2;
}
var rp = 0;
var ci = 0;
function eD(dt) {
var c = cE( dt.images );
for (var k = 0; k < c.length; ++k) {
var img = c[k],
width = img.getAttribute("width"),
height = img.getAttribute("height");
++ci;
if ( width == null || height == null ) {
img.width = "100";
img.height = "5";
img.title = "[Dimensions missing on image]";
++rp;
}
}
alert("Images replaced: " + rp + "/" + ci);
}
// "dIr" == "documentIterator"
function dIr(dt, f) {
function ifsr( fs )
{
for (var i = 0; i < fs.length; ++i)
{
try {
dIr(fs[i].contentDocument, fs[i]); // recursive call
}
catch (e) {
alert(e || "Unspecified error");
}
}
}
if (dt == null) {return;}
eD(dt, f);
ifsr( dt.getElementsByTagName("FRAME") );
ifsr( dt.getElementsByTagName("IFRAME") );
}
// iterate through all documents
dIr(document, null);
}());