@JackJoe said it well, you need to set a width to the wrapping div to match the width of the inner image.
Here is one way of doing it: http://jsfiddle.net/audetwebdesign/bpN8x/
Basically, I use jQuery to determine the width of the image and then set the width of the wrapper div.
Alternatively, if you were feeding the image from a CMS, you could determine the width of the image dynamically and then set the width on the wrapper div using an inline style.
I don't think a CSS-only is possible because of the way the box-model determines widths as content is laid out. Widths are inherited from the parent element, and are not passed up from the children elements.