Nothing happens on Insert
ltbrady - August 31, 2009 - 22:23
| Project: | Image Browser |
| Version: | 6.x-2.x-dev |
| Component: | User interface |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
After following the install instructions for both FCKEditor and Image Browser, I've managed to get this up and running to the extent that the Image Browser button shows up on the FCKEditor toolbar, the popup window with my image library, imagecache options, etc., displays properly.
However, once these options are set, clicking "Insert" seems to do nothing at all. I have the plugin folder correctly installed in FCKEditor's plugins, and I've enabled the Image Browser filter at admin/settings/filters and in the settings for FCKEditor. Is there something I'm missing here?

#1
Sounds like you are running a PHP-version which doesnt support json_encode() ( version < 5.2 I think).
#2
Yup, looks like it's 5.1.4. Short of convincing my host to upgrade (which is unlikely in the near term), are there any workarounds for this?
#3
Answered my own question -- posting the workaround here in case anyone else is in the same boat (shared hosting, older version of PHP, unlikely to upgrade soon).
After some searching, I found json_wrapper, which implements json_encode for earlier versions of PHP. You can find a zipped download at http://www.boutell.com/scripts/jsonwrapper.tar.gz. Just install the contents of this directory in the imagebrowser directory, and at the top of imagebrowser.module, insert the following line:
require 'jsonwrapper.php';
Make sure the whole unzipped package is installed, including its subdirectories. And of course, if you need to call json_encode from more than one module, you might want to install this somewhere more central and have the "require" line point there. But you get the picture...
Thanks for a fantastic module to the maintainer, by the way, who I guess is on vacation in Kenya. Well-deserved...
#4
#5
Hi
I had this problem too, with php 5.2.8, nginx and fcgi.
The problem was to do with the rewrite rules in the nginx config, and hard-coded url query strings in these two files:
modules/imagebrowser/js/imagebrowser.js
modules/fckeditor/plugins/imagebrowser/fckplugin.js
So as a quick workaround, I removed "index.php?q=" from the files.
eg, in imagebrowser.js, change:
/*** Call correct API for insert
*/
function ib_insert(fid, preset, link, link_target, styles)
{
$.getJSON(top.window.Drupal.settings.imagebrowser.basepath + 'index.php?q=imagebrowser/ajax&tag=[ibimage==' + fid + '==' + preset + '==' + link + '==' + link_target + '==' + styles + ']',
function (data, textStatus) {
ib_process_insert(data);
});
}
to
/*** Call correct API for insert
*/
function ib_insert(fid, preset, link, link_target, styles)
{
$.getJSON(top.window.Drupal.settings.imagebrowser.basepath + 'imagebrowser/ajax&tag=[ibimage==' + fid + '==' + preset + '==' + link + '==' + link_target + '==' + styles + ']',
function (data, textStatus) {
ib_process_insert(data);
});
}
#6
Tried this and still no insert functionality. I'm waiting to hear if PHP can be upgraded on my server. Crossing my fingers!
#7
Admin won't upgrade PHP until the Linux distribution adds a newer version. Any suggestions for getting this to work with 5.1.6 would be very appreciated. All the functionality in imagebrowser is working (showing thumbnails, uploading and deletion of images, etc) except the ability to insert.
I'm seeing a javascript error as follows when I click the Insert button:
Error: FCK is undefinedSource File: http://nuweb7.neu.edu/edtech_drupal/sites/all/modules/imagebrowser/plugi... 22
Not sure if that's related to the json_encode problem or if it's a separate issue.