19 include_once($ROOT_PATH.
'wysiwyg_plugin.inc');
45 $this->
_add_button(
'insertimage',
'InsertImage',
'Insert Image',
'false',
'34');
60 <script type=
"text/javascript" language=
"Javascript">
62 HTMLArea.prototype._insertImage =
function() {
65 var sel = this._getSelection();
66 var range = this._createRange(sel);
77 if (HTMLArea.is_gecko) {
78 var fragment = this._doc.createDocumentFragment();
79 var div = this._doc.createElement(
"div");
80 div.innerHTML = this.getSelectedHTML();
81 while (div.firstChild) {
82 if (div.firstChild.tagName ==
"IMG") {
84 var image_tag = div.firstChild;
88 fragment.appendChild(div.firstChild);
90 }
else if (HTMLArea.is_ie) {
92 if (range.item(0).tagName ==
"IMG") {
94 var image_tag = range.item(0);
100 if (is_image && image_tag) {
102 align = image_tag.align;
104 hspace = (!image_tag.hspace) ?
"" : image_tag.hspace;
105 vspace = (!image_tag.vspace) ?
"" : image_tag.vspace;
106 border = (!image_tag.border) ?
"0" : image_tag.border;
109 strPage =
"<?php echo $this->get_popup_href('insert_image.php')?>?f_url=" + escape(url) +
"&f_align=" + escape(align) +
"&f_alt=" + escape(alt) +
"&f_horiz=" + escape(hspace) +
"&f_vert=" + escape(vspace) +
"&f_border=" + escape(border);
111 this._popupDialog(
"insertImage", strPage, 398, 218,
true,
function(param) {
117 var url =
new String(param[
"f_url"]);
119 var html =
'<img src="' + url +
'"';
120 if (param[
"f_align"] !=
"") {
121 html +=
' align="' + param[
"f_align"] +
'"';
123 if (param[
"f_alt"] !=
"") {
124 html +=
' alt="' + param[
"f_alt"] +
'"';
126 if (param[
"f_horiz"] !=
"") {
127 html +=
' hspace="' + param[
"f_horiz"] +
'"';
129 if (param[
"f_vert"] !=
"") {
130 html +=
' vspace="' + param[
"f_vert"] +
'"';
132 if (param[
"f_border"] !=
"") {
133 html +=
' border="' + param[
"f_border"] +
'"';
137 if (!is_image || HTMLArea.is_gecko) {
139 editor.insertHTML(html);
142 image_tag.outerHTML = html;