code: function( url, filename )
              {
                  var html = '<img id="wysiwyg-insert-image" src="" alt=""' + (filename ? ' title="'+html_encode(filename)+'"' : '') + '>';
                  wysiwygeditor.insertHTML( html ).closePopup().collapseSelection();
                  var $image = $('#wysiwyg-insert-image').removeAttr('id');
                  if( max_imagesize )
                  {
                      $image.css({maxWidth: max_imagesize[0]+'px',
                                  maxHeight: max_imagesize[1]+'px'})
                            .load( function() {
                                  $image.css({maxWidth: '',
                                              maxHeight: ''});
                                  // Resize $image to fit "clip-image"
                                  var image_width = $image.width(),
                                      image_height = $image.height();
                                  if( image_width > max_imagesize[0] || image_height > max_imagesize[1] )
                                  {
                                      if( (image_width/image_height) > (max_imagesize[0]/max_imagesize[1]) )
                                      {
                                          image_height = parseInt(image_height / image_width * max_imagesize[0]);
                                          image_width = max_imagesize[0];
                                      }
                                      else
                                      {
                                          image_width = parseInt(image_width / image_height * max_imagesize[1]);
                                          image_height = max_imagesize[1];
                                      }
                                      $image.prop('width',image_width)
                                            .prop('height',image_height);
                                  }
                              });
                  }
                  $image.prop('src', url);
              }
docs: Add image to editor