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

    Recently, I've run in to the same issue for several clients: adding images in the content editor (one uses the old TinyMCE editor (where you can still toggle the usage of the editor) and the others use the newer one).

    But regardless of which one I use, the same issue occurs: it continues to use the relative path from whichever page your on. So on domain.com/page/ it looks for domain.com/page/img/file.jpg instead of domain.com/img/file.jpg.

    I know I'm supposed to change the system settings, but I've tried both the filemanager settings and the rb_base settings, but no matter what I try, it won't work.

    And: yes, I do have a base href set. It has both a Dutch version and a German version, so it has http://domain.com/nl/ and http://domain.com/de/ as the base hrefs.

    Does anyone have any idea on what I could try to make it work properly? The images in the editor should get img/file.jpg as the src, but /img/file.jpg (if I use a relative path "/") or http://domain.com/img/file.jpg (if I use an absolute path).
      • 17930
      • 81 Posts
      Are these on different contexts other than 'web'?
        • 48589
        • 33 Posts
        Yes, they are. Still, if there's no other context settings to overwrite them, that shouldn't be an issue, should it?
          • 17930
          • 81 Posts
          So for these pages: domain.com/page/here/there/ domain.com/page/here/
          The image urls are showing up as: domain.com/page/here/there/img/file.jpg domain.com/page/here/img/file.jpg
          But for both pages the url for the image should be: domain.com/img/file.jpg
          Right?


          You have all these system settings specified for each context?
          base_url - /
          http_host - domain.com/nl
          site_url - http://domain.com/nl/


          What did you change to notice that it started doing that? An upgrade? Does it do that for the context 'web'?


          All I know is that when I insert an image on any context other than 'web' I have to modify the path. For instance on context 'other-context' my image paths in the rich-text editor get created as: other-context/assets/images/image.jpg So I have to take out the text 'other-context/'
            • 48589
            • 33 Posts
            Let's take the 'About' page for example. In that case on the Dutch site it's domain.com/nl/about/ and on the German site it's domain.com/de/about/
            Both pages get a relative URL "img/file.jpg" but no matter which settings I add (I tried all of those you posted above as well), that base is never added to the path. The image is to be found at http://domain.com/img/file.jpg. But the resource manager just won't add any kind of base path to it (either "/" or "http://domain.com/". It doesn't help to add the / before the URL manually either, because upon saving, the editor changes it back automatically.

            That's why it'll always work on a single website, but not with multiple domains: because then you have one base href (domain.com), with the same URL that image needs.

            Using a relative or absolute path (according to the system or context settings) doesn't even matter, because nothing is done with that choice.


            So what I've got is:

            - 2 contexts (web & de)
            - 2 site_url settings (http://domain.com/nl/ & http://domain.com/de/)
            - 1 image (http://domain.com/img/file.jpg)
            - 1 TinyMCE editor that no matter what I try keeps the file src as just "img/file.jpg" instead of "/img/file.jpg" or "http://domain.com/img/file.jpg" (I've tried to set both as the base and setting either to use or not to use a relative URL).

            Other system settings (since they should be the same for both contexts):
            - filemanager_path: /
            - filemanager_url: /
            - rb_base_dir: /
            - rb_base_url: /
            - strip_image_paths: no (yet, it does)
              • 42562
              • 1,145 Posts
              RE: dizero

              TinyMCE uses its own base_path which you can configure.

              Upgrade to TinymceWrapper and you can do what you want
                TinymceWrapper: Complete back/frontend content solution.
                Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
                5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.