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

    I have an issue with my modx installation. Whenever I upload an image and link it in the editor I can see the image in the CMS, but when I go to the front end site the images are broken. Can anyone help?
      • 33982 ☆ A M B ☆
      • 476 Posts
      Could you provide a link to the site?  That may help us a little in seeing what is wrong.  Also, how are you setting up the Template Variable in your template?  It’s probably not configured correctly and as a result it’s not linking to the image correctly.  Could you provide the coding for the setup of the Template Variable for the image?  With the little info you’re providing it’s hard to diagnose the problem.
        Precision Web Development ... SmashStack.com
        • 12261
        • 7 Posts
        Here is a url to one of the pages that is breaking:

        http://www.sportsmenslink.org/sportsmens-caucuses/State-Sportsmens-Caucuses/Georgia-Caucus.html

        The odd thing is that sometimes the images will work on the front end page but then the urls seem to inadvertently change to the wrong url. huh
          • 33982 ☆ A M B ☆
          • 476 Posts
          I just looked at the file path to your images and the images don’t exist there:

          http://www.sportsmenslink.org/assets/images/State%20Caucus%20Leadership/Rep.MorrisGA.jpg
            Precision Web Development ... SmashStack.com
            • 12261
            • 7 Posts
            Thanks for the quick response!

            Correct. Thats the issue I’m having. When I use the CMS to this image the CMS is outputing this url:

            http://www.sportsmenslink.org/sportsmens-caucuses/State-Sportsmens-Caucuses/assets/images/State%20Caucus%20Leadership/Rep.MorrisGA.jpg

            the correct URL is:

            http://www.sportsmenslink.org/assets/images/State%20Caucus%20Leadership/Rep.EzzellNM.jpg

            So there’s something wrong with either the CMS or maybe a configuration or something.
              • 12261
              • 7 Posts
              Here’s a better example:

              http://www.sportsmenslink.org/sportsmens-caucuses/State-Sportsmens-Caucuses/Minnesota-Caucus.html

              I go into the CMS and I can see the images just fine. When I go to the front end site the images are broken. For instance:

              http://www.sportsmenslink.org/assets/images/State%20Caucus%20Leadership/Sen.PariesauMN.jpg is a correct image link, but when i go to the front end site this image is broken and when i right click on the image and click ’view image’ the url it’s trying to go to is http://www.sportsmenslink.org/sportsmens-caucuses/State-Sportsmens-Caucuses/assets/images/State%20Caucus%20Leadership/Sen.PariesauMN.jpg
                • 12261
                • 7 Posts
                So one thing I’ve figured out. The images that are working are absolute urls. I’ve changed the configuration on ’Rewrite Browser Paths’ to ’no’ so that MODX will write absolute URLS instead of relative urls. For some reason though, MODX is still writing image paths as relative instead of absolute. When I right click on an image and click the image properties and re-select the path to the image i want it enters an absolute URL into the textbox (starts with http://www...). I click ’update’ and then save the page. However the paths to the images are still coming out as relative paths instead of absolute paths as i specified. When I log back into the CMS and go to the page that I changed I right click the image again and sure enough, the image is still a relative URL. Can anyone help?
                  • 36592
                  • 970 Posts
                  I think you have to add following line in the <head>...</head> section of your site template.
                  <base href="[(site_url)]"></base>
                    • 12261
                    • 7 Posts
                    Yes i know to use that in the templates. The images that are breaking are images that you enter using the Tiny MCE editor. For some reason, no matter what I do, Tiny MCE is forcing relative links. I’ve tried going into the PHP code and actually force the attribute:


                    relative_urls : false

                    but even that isn’t working. It is STILL converting to relative links. So I added the following to the tinymce functions.php

                    convert_urls: false

                    and thats breaking the images too. I’m absolutely astonished that this is even an issue. I’ve used joomla thousands of times and never even thought that this kind of problem could exist. Anyone have any more ideas?
                      • 12261
                      • 7 Posts
                      Ok, I’ve been able to force Tiny MCE to only do absolute urls by implementing the before mentioned properties:

                      convert_urls: false,
                      relative_urls: false


                      I’m not sure why it wasn’t working before but everything seems fine now in the backend. However, when I save it, some php process runs and converts the urls back to relative urls!!??!??!?! I’ve quadrouple checked the database and the attribute for stripping images is 0 and in the CMS configuration it is the ’no’ option under rewrite browser asset paths. Can anyone else help me from here?