Uploads with FCKEditor


#1

Hello everyone.

Since I’ve found very poor documentation about the rails FCKEditor
plug-in and Easy-FCKEditor (which is a fork of the very same plug-in),
I decided to bother you with my noobish questions.

I have this weird sensation that the image-uploading feature of
FCKEditor isn’t supposed to work magically, without some sort of
server side preparation, but I have no idea about what to do to make
it work.

Weirdly, when I try to upload an image it gives a message saying that
the upload was successful, but fails to show the image (and the path
that it inserts in the editor’s ‘text area’ points to an unexistent
uploads/images/ directory. I created this directory inside public, and
I still can’t make it upload the image).

Also, when I try to open the file browser it shows this message:
“unknown error creating folder”.

I’m kind of used to the abstraction level provided by rails and other
upload plug-ins such as attachment_fu, so i know very little about how
to deal with this.

Any help will be apreciated.

Thanks

(I’m trying it on my development enviroment, which uses rails 2.2.2,
but I intent to use it in my mor.ph account when in production.)


#2

It works. The error messages it spits back can be a little vague.

I found that I needed to change the following (my version is first)
due to the new changes in Rails/rack/etc.

155c142,143
< unless [‘ActionController::UploadedStringIO’,
‘ActionController::UploadedTempfile’, ‘Tempfile’, ‘TempFile’,
‘StringIO’].include?(file.class.to_s)

# RAILS_DEFAULT_LOGGER.info "CLASS OF UPLOAD OBJECT:

#{file.class}"

unless "#{file.class}" == "Tempfile" || "StringIO"

#3

I used fckeditor for some projects but I find that TinyMCE editor and
rails plugin is better, for all my new rails projects now I’m using this
plugin:

script/plugin install git://github.com/kete/tiny_mce.git

The upload mechanism does’nt exist but if you prepare a simple
controller/view for your upload system, the integration is really
simple…

For example with this simple javascript included into your page you can
control image / link / multimedia upload, in my case I have:

<script type='text/javascript'>
  var returnURL = "";
  var browserWindow;
  var browserFieldName;
  function fileBrowserCallBack( field_name, url, type, win ){
    if (type == "file") {
      browserUrl = "/admin/files";
    else if (type == "media") {
      browserUrl = "/admin/medias";
    } else {
      browserUrl = "/admin/images";
    }
    window.open(browserUrl, '', 

‘width=800,height=400,scrollbars=yes’);
browserWindow = win;
browserFieldName = field_name;
}

  function browserReturn(url) {
    browserWindow.document.forms[0].elements[browserFieldName].value

= url;
}


#4

Thank you for the feedback. I’ll certainly try tinymce in a future
project.

It turn’s out someone on the net has figured out how to make easy-
fckeditor work properly with rails 2.2.2, and with his advice, now it
works in my project too.

if anyone is having the same problems I was, just check this page:

http://davidebenini.it/2009/03/23/patches-for-the-easy-fckeditor-rails-plugin/

On 3 abr, 04:06, Gianluca T.


#5

Thank you for the feedback. I’ll certainly try tinymce in a future
project.
It turns out someone on the net has figured out how to make easy-
fckeditor work properly with rails 2.2.2, and with his advice, now it
works in my project too.
if anyone is having the same problems I was, just check this page:
http://davidebenini.it/2009/03/23/patches-for-the-easy-fckeditor-rail

On 3 abr, 04:06, Gianluca T.