Forum closed. New forum available at

Mod for uploading images from WYMeditor

Discuss features, code, contributions, ideas, suggestions, ...
For bugs, patches and feature requests, please post on the Trac:

Mod for uploading images from WYMeditor

Postby wymtuut on Mon Sep 21, 2009 11:57 am

I saw some other posts and tickets about upload images from the editor, but I couldn't find a mod or plugin for it so I made one myself. It adds two fields to the Image dialog:
  • A upload form which submits to itself using AJAX, using code from, the location of the uploaded image will be automatically inserted into the URL field and the dropdown list
  • A dropdown list with a list of all images in a directory, users can select an image from the list which will then be inserted in the url field. New uploads will automatically appear in this list. This dropdown is filled by AJAX when the image dioloag is opened.
The upload image dialog
image_add.png (18.52 KiB) Viewed 6169 times

For these to work I've edited the dialogImageHtml section in jquery.wymeditor.js to add the fields and load the AJAX. I've also used two files: wymeditorajax.js which contains the ajax code and wymeditorajax.php which handles the uploads and returns file information. The PHP file returns Javascriptcode which is then eval'd by the JS-file.
To use it just edit the 3th line of the PHP file to your images directory, and make sure your HTML files are using jquery.wymeditor.js and not the packed or mini-version. I've added a zip with all the files needed to get this working.
I hope someone will find this mod usefull and/or can use my code for creating a proper plugin to do this. I have only tested it on my own server with Firefox, but it should work on most PHP enabled servers using a decent browser.
Mod with image uploads
(200.84 KiB) Downloaded 821 times
Posts: 1
Joined: Mon Sep 21, 2009 8:07 am

Re: Mod for uploading images from WYMeditor

Postby Anniepannie on Sun Nov 29, 2009 5:58 pm

Is this supposed to work just by replacing my files by yours?
(I made some 'images' and 'bestanden' directories with some images in there, but nothing ever turned up in the dropdown menu...)
It's doesn't really do anything, the only thing it does do is giving the upload error if I click on submit without chosing a file to upload (so it does find all the files, they just don't seem to work :? )

Any tips? Because it'd be exactly what I need!
Posts: 3
Joined: Sat Nov 28, 2009 9:23 pm

Re: Mod for uploading images from WYMeditor

Postby appiee on Wed Feb 10, 2010 4:05 pm

Hi Wyntuut,

Thanks for your mod. It works beautifully. I made something myself with a list&upload-file (thus copying the image-url manually) but this is the way to go.
I noticed the wymeditor doesn't show images with relative urls, so i altered this line in wymeditorajax.php:

Code: Select all
echo "theOption.value   = 'http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/".$item['url']."';\n";

groet, Albert
Posts: 1
Joined: Wed Feb 10, 2010 2:39 pm

Re: Mod for uploading images from WYMeditor

Postby pzh20 on Tue Apr 13, 2010 11:23 am


Can you tell us how you installed this plugin? Like anniepannie, I am supposing that I replace wymeditor completely with this zip extract?

Also, what about the directory structure? I want to be able to use it from any directory, but have all images to the same location.

Any info would be useful, wymtuut doesn't seem to be around any more.

Posts: 1
Joined: Wed Mar 31, 2010 1:35 pm

Return to Developers

Who is online

Users browsing this forum: No registered users and 2 guests