I've installed and configured Imagebrowser to use the WYSIWYG-API with FCK-Editor 2.6.5 on drupal 6.14. Everything works fine, except the final step. I created a new input format that uses only the Image Browser Filter. Than I configured the FCKEditor Profile to show only the button for the image browser.

So I can create a new page and choose my new input format. The FCK comes up with the imagebrowser button. I hit the button and the imagebrowser shows up with my images. I can choose an image and set all options. But finally when I hit 'Insert', nothing happens, the image browser stays open and no image is inserted. 'Cancel', 'Close' and 'Delete' do what they are supposed to do, but 'Insert' does not work.

Comments

jdelaune’s picture

Getting any javascript errors?

ppcc’s picture

Hi

See this thread:

http://drupal.org/node/564822

Algebraist’s picture

That is a good hint! Currently I'm using PHP5.1, so this might be the cause. I will update my PHP and report if it fixes this issue.

Algebraist’s picture

Status: Active » Fixed

Yes, that solves it. I updated my php to 5.2.6 and now it works like a charme.
So I think the requirements in README.txt should claim that only PHP >= 5.2 is supoorted (json_encode() is available).

jdelaune’s picture

Title: 'Insert' does not work » Update requirements for json_encode()
Status: Fixed » Needs work

Thanks for flagging this. I might write a custom json_encode() to do the job.

scroogie’s picture

This is from the php.net documentation page of json_encode, a substitute:

if (!function_exists('json_encode'))
{
  function json_encode($a=false)
  {
    if (is_null($a)) return 'null';
    if ($a === false) return 'false';
    if ($a === true) return 'true';
    if (is_scalar($a))
    {
      if (is_float($a))
      {
        // Always use "." for floats.
        return floatval(str_replace(",", ".", strval($a)));
      }

      if (is_string($a))
      {
        static $jsonReplaces = array(array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"'), array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"'));
        return '"' . str_replace($jsonReplaces[0], $jsonReplaces[1], $a) . '"';
      }
      else
        return $a;
    }
    $isList = true;
    for ($i = 0, reset($a); $i < count($a); $i++, next($a))
    {
      if (key($a) !== $i)
      {
        $isList = false;
        break;
      }
    }
    $result = array();
    if ($isList)
    {
      foreach ($a as $v) $result[] = json_encode($v);
      return '[' . join(',', $result) . ']';
    }
    else
    {
      foreach ($a as $k => $v) $result[] = json_encode($k).':'.json_encode($v);
      return '{' . join(',', $result) . '}';
    }
  }
}
Macronomicus’s picture

hmm im running PHP 5.2.6-3 .... I am using pressflow drupal and also in the Pantheon Mercury ubuntu server with Varnish and APC. I sure hope its not some cache issue and that its json.. json seems easier to fix!

I am using a current PHP but still have a dead Insert button, is this for sure a json issue?
Firebug output...

FCK is null
ib_process_insert(Object fid=1134 preset=Original link_preset=none)ib_fckeditor.js?n      (line 22)
anonymous(Object fid=1134 preset=Original link_preset=none, "success")imagebrowser.js?n     (line 16)
success()jquery.j...val/seq/1     (line 1)
anonymous(7)jquery.j...val/seq/1     (line 1)
[Break on this error] var oImage = FCK.Selection.GetSelectedElement() ;\nib_fckeditor.js?n     (line 22)
peter törnstrand’s picture

Assigned: Algebraist » Unassigned
Status: Needs work » Fixed

The method described in #6 is now implemented.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.