UPLOAD IMAGES FOR HTMLAREA
==========================
Purpose: To be able to upload an image when inserting images in htmlArea. Without this hack, only previously uploaded files could be used. Now it's possible to upload a file, preview it, and use it in htmlArea right away.
Verified for version: Pagesetter 6.0.1, htmlArea 3.0 beta
Install: Copy the file insert_image.php into modules/pagesetter/guppy/HTMLArea30beta/popups . Configure it by editing some variables at the top of the file (documented within it). Note that the default configuration will probably not work. A directory with proper permissions should be created for images to be uploaded. Finally, apply the following patch, replacing a parameter pointing to insert_image.html by the PHP file:
Edit file: modules/pagesetter/guppy/HTMLArea30beta/htmlarea.js
[...]
// Called when the user clicks on "InsertImage" button. If an image is already
// there, it will just modify it's properties.
HTMLArea.prototype._insertImage = function(image) {
var editor = this; // for nested functions
var outparam = null;
if (typeof image == "undefined") {
image = this.getParentElement();
if (image && !/^img$/i.test(image.tagName))
image = null;
}
if (image) outparam = {
f_url : HTMLArea.is_ie ? editor.stripBaseURL(image.src) : image.getAttribute("src"),
f_alt : image.alt,
f_border : image.border,
f_align : image.align,
f_vert : image.vspace,
f_horiz : image.hspace
};
//BEGIN UPLOAD IMAGES FOR HTMLAREA
this._popupDialog("insert_image.php", function(param) {
//END UPLOAD IMAGES FOR HTMLAREA
if (!param) { // user must have pressed Cancel
return false;
}
var img = image;
[...]
Template courtesy of Designs By Darren.