code: function() {
              if (this.popup.id === null) { // this.popup has been destroyed!
                  return;
              }
              this.popup.updateSize();
       
              if ( this.popup.visible() && this.popup.panMapIfOutOfView ) {
                  this.popup.panIntoView();
              }
  
              OpenLayers.Event.stopObserving(
                  this.img, "load", this.img._onImgLoad
              );
      
          }
docs: As the images load, this function will call updateSize() to resize the popup to fit the content div (which presumably is now bigger than when the image was not loaded).  If the 'panMapIfOutOfView' property is set, we will pan the newly resized popup back into view.  Note that this function, when called, will have 'popup' and 'img' properties in the context.