DOCUMENTATION | ADDONS | EXAMPLES

Addons

Copyright (c) 2006 openWebWare.com

openImageLibrary addon (PHP)

Here we want to explain how you can use the openImageLibrary addon (for now PHP only) to let your users uploading, browsing and selecting images on your webserver.
First you have to download the latest version of the openWYSIWYG modification, which includes the openImageLibrary addon.
You will find a directory called addons in the root of the openWYSIWYG directory. If it not there you do not have the latest version of the openWYSIWYG editor.

To enable the openImageLibrary addon you have to customize the insert image popup implementation of the openWYSIWYG.
The following shows how you change the implementation of the insert image popup.

var mysettings = new WYSIWYG.Settings();

// define the location of the openImageLibrary addon
mysettings.ImagePopupFile = "addons/imagelibrary/insert_image.php";
// define the width of the insert image popup
mysettings.ImagePopupWidth = 600;
// define the height of the insert image popup
mysettings.ImagePopupHeight = 245;

Attach the editor on the textarea with the previously defined mysettings object.
<script language="javascript1.2">
   WYSIWYG.attach('textareaID', mysettings);
</script>

Now try it out!



Customize the openImageLibrary addon

This section describe how you can customize the openImageLibrary addon.

Settings of the openImageLibrary addon:


The following settings can be modified within the config file (addons/imagelibrary/config.inc.php)
$imagebasedir = '../../uploads'; Path to a directory which holds the images.
$imagebaseurl = 'uploads'; An absolute or relative URL to the image folder. This url is used to generate the source of the image.
$browsedirs = true; Allow your users to browse the subdir of the defined basedir.
$allowuploads = true; If enabled users will be able to upload files to any viewable directory. You should really only enable this if the area this script is in is already password protected.
$overwrite = false; If a user uploads a file with the same name as an existing file do you want the existing file to be overwritten ?
$supportedextentions = array(<file extensions>); Define the extentions you want to show within the directory listing.
The extensions also limit the files the user can upload to your image folders.
$filetypes = array (<extension> => <filename>) If you want to add your own special file icons use this section below. Each entry relates to the extension of the given file, in the form <extension> => <filename>.
These files must be located within the dlf directory.