We've made these forums available as a read-only reference and knowledge-base for people using or developing editors based on htmlArea 2 or 3.

Anyone who is interested in taking over version 2 or 3 is free to do so. All we ask is that you choose a new name that doesn't have "htmlarea" in it to avoid confusion with this site. We'll even give you a link in the directory to make it easier for people to find you. If you are developing or hosting an htmlArea based-editor under a new name, please submit it to our directory.

Ok....since this code is fine, I figure it must be something wrong with my code on the text editor page itself. Perhaps I'm missing a line of javascript below. Any ideas on why the paste icon isn't showing up?

I just thought I would take a moment to say how pleased I was to find this web based editor.

I have been having problems developing for my Intranet when dealing with Word documents, and I hope that now I have found this editor I will have reduced those challenges greatly.

I was wondering however if it would be a simple enough change to modify the <v:imagedata> tag instead of remove it. If it could be modified to an <img> tag then I am certain that the 'src' attribute could be detected (it's a temp local file) and then automatically uploaded through the upload mechanism.

This really would be of great benefit as many of the documents I deal with contain illustrations, photos, and sketches. The only image types I allows however are gif,jpg, and png.

I've written the basic functionality a few weeks ago, which will be implemented in a CMS i'm writing. The script is completely commented in Dutch, so i first have to make some translations.

I'm still working in a testing environment and not on a real server, so I haven't had a proper opportunity to test the uploading part of the script, since I want to use ftp-functionality instead of uploading a file/image true a form.

I still wasn't able to test the ftp-routine, but i believe it will work anyway. In fact, ftp-ing the image should not be the biggest problem, so i decided to post the script anyway. For development purposes i used copy ($original, $copy) on my local machine and furthermore i was able to 'ftp' files from my local machine to servers (which didn't support PHP).

The script only works with jpg-images. It should no be too difficult to let it work with BMP- and PNG-images.

Also, this script won't resize or resampled the uploaded image. In my CMS i use other scripts to do that.

Sice PHP works server sided you have to include the script after you've submitted your text to the Mysql-database.

I hope this script can be usefull to anybody. I'm not a professional programmer and only working with PHP for a few months, so any improvements are welcome. Since the script works server sided i consider it a sub-optimal solution. Perhaps someone can rewrite it in Javascript.

Regards, Koen Willems

Code

<?php // Written by Koen Willems, The Netherlands, 2004 // This script will check inserted Word-documents for jpg-images, alters the source with the desired code // and uploads the images to your server. At last it will update the value of your textarea in your Mysql-database. // Take care that $id is the id-number of the record you want to change; for example, you can use $id=mysql_insert_id() before including this script // this script will rename the images, depending on the id-number of the record // for example: when we are working with a record with id 735, the images wil renamed to 735_3.jpg, 735_4.jpg,and so on // it's the way i incorporate images in my CMS, but of course you can alter it. error_reporting(E_ALL); $path = 'src="http://www.website.com/images/'; // the source should become something like this $path_copy ='../images/'; // relative path to the folder where we want to put the images $query = "SELECT id,textarea FROM table WHERE id='".$id."'"; $result = mysql_query ($query,$tabel_db) or die (mysql_error()); $table = mysql_fetch_assoc($result); $textarea = $table['textarea'];

if ($src != 'src="http:') // check if it is src="http: ..." { // if not, the sourcecode of the document has to be altered $part = explode (".jpg", $matches[0][$i]); $part1 = $part[0]; //everything until .jpg, so now it's like src="file:///.../.../image001

$part = explode ("///", $matches[0][$i]); $original = $part[1]; // everything from ///, because we have to find the name of the original $original = explode ('"', $original); // at the end there is "> $original = $original[0]; // so now we have the original

$target = $table['id'].'_'.$number.'.jpg';

$copy = $path_copy.$target;

// now we are going to ftp the file to the server // variables which we use to connect $ftp_server = "ftp.website.com"; $ftp_user_name = "username"; $ftp_user_pass = "password";