
click image to enlarge
The catch with the first option is since the invention of Tabs in the Browser, the window might pop-up in a new tab and it will not be resized.
Basic Javascript - Image Popup Example

click image to enlarge
The advantage of this option is it should always pop-up in a new window and if js is disabled client side it will default back to the first method.
You can easily expand on the method to do more visual effects + add code to read the size of the image and resize the pop-up accordingly.