We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26016
    • 561 Posts
    Recently I’ve had a couple clients who will be doing a lot of editing on their sites, always an inexact science (shudder). I’ve gone through a LOT of grief getting the browser to:
    a. show the right files when trying to browse to and insert a pic.
    b. having preview work both in the browser and in the editor window after selecting an image.

    Sounds simple, but after reading countless posts about this, it’s often nasty. I thought I’d share what worked for me so that someone out there will have fewer headaches than I had. Obviously, YMMV - I can’t speak for IIS, for instance. Hosts often differ, too, at the server level. Anyway...

    There are 2 key settings that I found that greatly affected what I was doing. Despite their names, they effect Tiny, too. They are located in here:
    \manager\media\browser\mcpuk\connectors\php\config.php

    $fckphp_config[’urlprefix’]="/assets/YourSpecialFolder";
    This setting is the key for getting Preview to work. Note the beginning slash, and no trailing slash! In the example, I have a special folder for the client’s stuff. The config.php contains a default line of code that tries to figure out the correct path for this parm. In my experience, it didn’t work for Tiny or FCK, so I needed to hard-code it. If you’re not using a special folder, you could probably use "/assets". Either way, whatever you put here should probably match MODx configuration (minus the trailing slash): Tools-Configuration-Interface-Resource URL. (Resource Path needs to be set correctly too - on my system it had the whole hard-coded server path all the way to the upload folder).

    $fckphp_config[’UserFilesPath’] = "";
    This is the key for getting the Images to appear when you use the Image Browser in the editors; what you see in the file browser when you actually try to find a file to add to your edited page. I found that having "nothing" in here was good for both FCK and Tiny, and FF and IE browsers. One key is that you have to have the right setting in Resource URL (see last paragraph). Putting the wrong thing here may cause the "Invalid XML response..." error in IE, or may just show no files at all.

    [I mention this because I wasted a lot of time trying various things here - I even tried just one slash, and this allowed FF and IE6 to work, but borked IE7!]

    Many folks also get "Invalid XML response from connector" due to another reason (there are many causes for this error in the code!). This works for some people (I didn’t need it):

    \manager\media\browser\mcpuk\connectors\php\Commands\GetUploadProgress.php

    In "GetUploadProgress.php" Just add:

    header ("content-type: text/xml");
    echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";

    directly after:
    //Progresshandler not specified, return generic response

    Other things to check:

    • Be sure your folder that you want to use for images, etc. is set to 777 permissions.
    • GD has to be active for image display (for preview). Check with your tech support.
    • suhosin - this is a PHP security app that I just found out about. It can bork the editors if it’s on - talk to your sysadmin.
    • If all else fails, RTFM. This is actually a pretty good readme: \manager\media\browser\mcpuk\connectors\php\Docs\readme.txt

    Final thought: I wasted a lot of time looking at plug-in code for FCK under the /assets folder. There are config parms to set there, but messing with them did not help me at all (it may help others). Same with Tiny, actually. I also understand that the Mcpuk browser is not being used that much by FCK users anymore, so support from that angle may be waning.

    Recently I’ve been plundering other people’s brains here to great effect, so I thought I’d try to give back by helping with something. I hope it helps you!

    Samba
      MODx and Wordpress development
      Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4
      • 21341
      • 26 Posts
      First of all: modx is great besides my little problems. I got gallery2 to work fine and made newspublisher insert snippets, but this problem i ignored all the time. Now i want to get it solved.

      After searching this forum and trying several things (permissions, paths, user rules etc.) i found this thread and tried it too.
      But it didnt solve my problem with displaying images in the browser.

      I use modx 0.9.6.2 and the tinyMCE (updated to 3.2.0.1). Inserting images by typing the path works fine. Also uploading works and i get no errors, the files are there (checked with ftp) and i also can see folders within my assets/images folder, but no images itself.

      What went wrong?