callback = function (){
            var h0 = img.height();
            var w0 = img.width();
            if (!(h0 && w0)) {
                // zero size, don't make it resizable
                return;
            }
            img.resizable({
                aspectRatio: true,
                autoHide: true
            });
            img.dblclick(function () {
                // resize wrapper & image together for some reason:
                img.height(h0);
                img.width(w0);
                if (resize_parent === undefined || resize_parent) {
                    img.parent().height(h0);
                    img.parent().width(w0);
                }
            });
        }
Add a resize handler to an element

img: jQuery element
immediately: bool=False
     Wait for the element to load before creating the handle.
resize_parent: bool=True
     Should the parent of the element be resized when the element is
     reset (by double click).