Automatically Resize Popup

Hmm, how would you make a popup that would resize to how big the image was you were trying to place in the popup?