We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20751
    • 122 Posts
    Hi,

    After following the advice on various threads to add images to a webpage using relative instead of absolute paths, I cannot seem to see the images inside the FCK editor window anymore.

    Is this just a consequence of setting the Resource URL to "assets/" or "/assets" (i’ve tried both), or is there something else I need to do to get images to show up in FCK when editing documents.

    Hope that makes sense . . . any help/pointers are greatly appreciated!

    Thanks
    smiley
      • 20751
      • 122 Posts
      Does anybody have _any_ suggestions?

      Please?

      sad
        • 4018
        • 1,131 Posts
        In the System Configuration, what do you have set for both the Resource path and URL? Also, with the FCKEditor up, open the source for the frame that the editor is in. Look for the line that has the value for the resource_browser_path parameter and give me the value of this parameter. Both should help me in determining what might be going on. smiley
          Jeff Whitfield

          "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
          • 27088
          • 11 Posts
          Shocking_blue Reply #4, 20 years ago
          Sorry no suggestions. I have been wondering myself the very same question. I have used absolute paths i.e. http://localhost/path/to/subdirectory/assets/images/ when building a site locally so to at least have the images turn up in the FCK editor.

          Now I am dumping the data from the database and do a global replace on http://localhost/path/to/subdirectory/ to make the image paths relative. But to me it seems the long way around to achieve such simple thing; perhaps there is something else we need to do but we are both not seeing what that something else is.

          I remember from an other site I was doing that when testing some Javascript I put similar lines of code as below in the original script to tell it whether I was browsing off-line or on-line. Perhaps this code could be included in the FCK editor code but then again I am not much of a coder so what do I know tongue

          var baseHREF = "http://www.domain.com/path/to/subdirectory/assets/images/";	// base path to image files (ie: resources/)
            var thisLoc = document.location.href;
            if ((thisLoc.indexOf("http://")==-1)&&(thisLoc.indexOf("wysiwyg://")==-1)) {
               baseHREF = "C:/wamp/www/domain name/assets/images/";
               if (op5||op6) { baseHREF = "file://localhost/C:/wamp/www/path/to/subdirectory/assets/images/"; }
               if (ns4||ns6||mz7) { baseHREF = "file:///C:/wamp/www/path/to/subdirectory/assets/images/"; }
               }
            • 20751
            • 122 Posts
            Hi Bravado . . . thanks for the help:

            Resource path: /var/www/vhosts/mysite.com/httpdocs/assets/
            URL: assets/ (also tried /assets/)

            The url is set like this so i can test locally without having to change each image when I move to a production server.

            I can’t find anywhere in the source of the frame where FCK editor is close to resource_browser_path. I found a bunch of lines with the word "browser" by doing a find and replace in dreamweaver:


            var FCKImageBrowserURL = '/manager/media/browser/mcpuk/browser.html?Type=images&Connector=/manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath=/';
            			var FCKLinkBrowserURL = '/manager/media/browser/mcpuk/browser.html?Connector=/manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath=/';
            			var FCKFlashBrowserURL = '/manager/media/browser/mcpuk/browser.html?Type=flash&Connector=/manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath=/';


            And this

            <script language='javascript' type='text/javascript'>var oFCKta = new FCKeditor('ta');oFCKta.Width = '100%';oFCKta.Height = '400';oFCKta.BaseHref = 'http://www.mysite.com/';oFCKta.BasePath = '/assets/plugins/fckeditor/';oFCKta.Config['ImageBrowser'] = true;oFCKta.Config['ImageBrowserURL'] = FCKImageBrowserURL;oFCKta.Config['LinkBrowser'] = true;oFCKta.Config['LinkBrowserURL'] = FCKLinkBrowserURL;oFCKta.Config['FlashBrowser'] = true;oFCKta.Config['FlashBrowserURL'] = FCKFlashBrowserURL;oFCKta.Config['SpellChecker'] = 'SpellerPages';oFCKta.Config['CustomConfigurationsPath'] = '/assets/plugins/fckeditor/custom_config.js';oFCKta.ToolbarSet = 'standard';oFCKta.Config['EditorAreaCSS'] = FCKEditorAreaCSS;oFCKta.ReplaceTextarea();</script>


            Does that help?

            Desperate to get this solved! Shocking_blue . . . I feel your pain! Maybe we’ll get somewhere real soon!

            Thanks!!



            EDIT:
            Just done a search through the entire site for resource_browser_path . . . didn’t turn up anything. Am I spelling it right?
              • 20751
              • 122 Posts
              Any luck Jeff?
                • 4018
                • 1,131 Posts
                Ok...try this. For the Resource Path and URL settings, try the following:

                Resource path: /var/www/vhosts/mysite.com/httpdocs/assets
                URL: http://www.mysite.com/assets/

                Based on what I have in my own configuration, it might help to have the full URL for the URL path and no ending slash for the Resource path. Give that a shot and see if that helps. smiley
                  Jeff Whitfield

                  "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
                  • 20751
                  • 122 Posts
                  YAY!

                  That works perfectly! Thank you!

                  So . . . I took off the trailing slash for the resource path but to ensure that I can still test images locally I changed the URL to "/assets/" so I can still test locally without having to change all the image paths. Plus I can move the site much more easily to another domain if needed.

                  The only sacrafice is that now when I test locally, instaed of my modx projects being tested at:

                  http://localhost/projectname/index.html

                  I simply move my modx site to the root of my testing directory so I can test at:

                  http://localhost/index.html