Hallo kuerbis42,
function showimage(imagename) {
tmpimg =new Image();
tmpimg.src = imagename;
newx = tmpimg.width;
newy = tmpimg.height;
tmpimg.free;document.getElementById('bigpicture').src = imagename;
document.getElementById('bigpicture').width = newx;
document.getElementById('bigpicture').height = newy;
return;
}
Inmage unterstützt den onload-Event, ich würde es daher so lösen (ungetestet):
~~~javascript
function showimage(imagename) {
tmpimg =new Image();
tmpimg.onload = function() { // anonyme Funktion, die aufgerufen wird, wenn das Bild geladen ist
newx = tmpimg.width;
newy = tmpimg.height;
tmpimg.free;
document.getElementById('bigpicture').src = imagename;
document.getElementById('bigpicture').width = newx;
document.getElementById('bigpicture').height = newy;
}
tmpimg.src = imagename;
return;
}
Gruß, Jürgen