Use the onload
event:
document.getElementById('testimg').onload = function() {
alert(document.getElementById('testimg').offsetHeight);
}
You can change the action in the function, for example, making your buttons visible, or un-disabled, up to you.
Not sure I understand your question, but Javascript will need to load the image before you can get its dimensions.