Dynamically Change the size of a Frame onload

I want to dynamically load an image into a box/frame (got that figured out) and then have the box/frame resize according to the image’s dimensions (how do I do that?).