Is this possible to achieve by a not-to-complicated HTML / Javascript programming?
you would be best using a specific size, what you could do is have it as big as possible and then force it to be smaller and link to a full version when you click on it, normally an image viewed on its own in a browser will get as big as it can without scrolling if its bigger than the window and only if you click o it it will become full size so that you have to scroll