js:
var M = E.getSelection().match(new RegExp('^\\[img(?:=(\\d+)x(\\d+))?](.+)\\[/img]$')) || ['', '', '', ''];
var form = [
 {name: 'src', title: 'URL', value: M[3], suffix: eDefBrowseButton('/?q=imce', 'attr_src', 'Browse', 'image')},
 {name: 'width', value: M[1]},
 {name: 'height', value: M[2]}
];
eDefTagDialog('img', form, 'Insert/edit image', 'OK', 'bbcImgProcess');

bbcImgProcess = function(tag, form) {
  var src = form.elements['attr_src'].value;
  var width = form.elements['attr_width'].value;
  var height = form.elements['attr_height'].value;
  var str = '[img'+ (width ? ('='+ width +'x'+ height) : '') +']'+ src +'[/img]';
  editor.dialog.close();
  if (src) editor.active.replaceSelection(str);
}