image naturalWidth return zero

I’d guess it’s because you’re not waiting for the image to load – try this:

var newimage = new Image();
newimage.src="https://stackoverflow.com/questions/1645166/retouche-hr" + newlinkimage.substring(14,17) + '-a.jpg'; 
newimage.onload = function()
{
    var width = this.naturalWidth;
    alert(width);
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)