Commit e6e14440 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_corporate_identity: wait for image to be loaded

otherwise naturalWidth/naturalHeight may be 0
parent e9b98429
......@@ -39,9 +39,8 @@ Creates the Book header.
var y = document.getElementsByClassName(x[i]);
for (var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
}
var z = document.getElementsByClassName("hack");
for (var k=0; k<z.length; ++k) {
var pic = z[k];
}
function setImageSize(pic) {
if (pic.naturalWidth / pic.naturalHeight <= 1) {
pic.style.width = "auto";
pic.style.maxWidth = "28mm";
......@@ -49,7 +48,6 @@ Creates the Book header.
pic.style.height = "auto";
}
}
}
</script>
</head>
<body class="ci-book" onload="setPlaceholdersWithUrlParameters()">
......@@ -65,7 +63,7 @@ Creates the Book header.
<tr>
<td>
<div class="ci-book-header-image-wkhtmltopdf-image-wrapper">
<img class="hack" tal:attributes="src python: book_logo_url; alt python: book_logo_title"/>
<img class="hack" onload="setImageSize(event.srcElement)" tal:attributes="src python: book_logo_url; alt python: book_logo_title"/>
</div>
</td>
<td>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment