I have an
<img>
<p>
<div>
This works perfectly. Note that you have to use $(window).load() instead of $(document).ready(), because $(document).ready() fires before images are actually loaded, and thus the images will have no width.
$(window).load(function() {
$('div').each(function() {
$(this).width($(this).find('img').width());
});
});
Edit: Note that this will base the width off of the first image in the div. Simply change the index ([0]) to base it off another image in the div.
Edit 2: Applied John's correction on the .width() function.