I have some code that when the page loads gets the height of an image and then resizes its container div accordingly. This works fine unless its the first time the page has
You could use some jQuery plugin like this one https://gist.github.com/797120/b7359a8ba0ab5be298875215d07819fe61f87399