Really cool and useful extending of ImageProperty function: who helps?

#1

We know, there are pretty much images in the wild web, which physical size (naturalWidth, naturalHeight) are much bigger, than the rendering place, which is applyied to them by CSS and HTML by browser. These are pretty annoying parameters, specially if we go on the image compression - because image compression remains ineffectiv, if real size of the image remains higher, than it should.

ImageProperty gives us the possibility to get width and height of the rendered image size. But what is with naturalWidth and naturalHeight? To get them both it needs just some short Javascript lines, like here: https://goo.gl/R2QQg3 - this code prints naturalWidth and naturalHeigfht into console.log

JS:

img = document.getElementById('image');

img.addEventListener('load', function() { 
  console.log('width', img.naturalWidth);
  console.log('height', img.naturalHeight);
});

CSS:

#image {
  width: 200px;
}

HTML:

<img id="image" src="http://i.imgur.com/PDE3MLe.jpg" />

If any cool hacker would extend the ImageProperty function of SeoTools by this Javascript - this would be such a quick win and great deal, gulls and guys!

BTW: is it just by accident, that the Spider@SeoTools doesn't have the option ImageProperties?

#2

Hi,

Thanks! That is great feedback! I'll run it by Niels :slight_smile:

#3

Even installed 7.0.24 - is not here jet :cry:
Maybe its possible to get naturalWidth/Height with adjusting of Strings→PixelWidth function? This function is so close to the needed one - but works only for texts. If it would work for any HTML element - it would be a mighty wonder!

#4

This is not as easy as it seems to build as it would require a full web browser to render the page. I'm experimenting with some solutions.