I am using lazy load plugin (jquery.lazyload.js) and I try to get the image size that it loads. So in the display part I have:
echo '<img #img id="img-' . $i . '" name="' . $filename . '" class="lazy" data-original="'.$image.'" />';
Java Script:
<script type="text/javascript">
displaysize(img) {
console.log(img.clientWidth, img.clientHeight);
}
</script>
<script src="js/rectangle3.class.js"></script>
HTML:
<div id="imgsize">
<p id='imgsize-debug'></p>
<button id='map-download-btn' onclick='displaysize();'>Image size:</button>
<div id='imagesize'></div>
</div>
The image display is ok but when I add displaysize(img) function to the script and button, the page keep loading. I will need to get image size for calculation in my java script file,
document.getElementById("rectRecord-" + this.rectPointer).innerHTML =
"Rectangle " + (this.rectPointer + 1) + " ("
+ this.startX + ", "
+ this.startY + ", "
+ this.endX + ", "
+ this.endY + ")"
need to change to:
document.getElementById("rectRecord-" + this.rectPointer).innerHTML =
"Rectangle " + (this.rectPointer + 1) + " ("
+ (this.startX)/width + ", "
+ (this.startY)/height + ", "
+ (this.endX-this.startX)/width+" , "
+ (this.endY-this.startY)/height +""