We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5271
    • 5 Posts
    Hi everyone. I’ve just installed MODx 1.0.4 and I’m having trouble getting images to display.

    Instead of an image, I just get a bounding-box with a ’broken page’ icon in the corner and \"\" come after it. When I go to View Image (in Firefox), I get this message: The requested URL /\"assets/images/under-construction.jpg\" was not found on this server.

    The ’File browser’/’File base’ paths etc are all set to their defaults and I’m really not sure what else to try. Have I missed a setting somewhere? huh

    Thanks in advance!


      • 18373 ☆ A M B ☆
      • 3,141 Posts
      Could you provide a link to where this is happening?

      You’re using a template variable to select an image? How is it being shown in your template?
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 5271
        • 5 Posts
        Hi Mark - that was quick!

        Ok, here’s a link to the page: http://www.worldimpactcentre.com/index.php?id=2

        Template is set to ’(blank)’ and all I’ve done is inserted the image using TinyMCE. The source code looks like this:
        <p>this is a test</p>
        <p><img src="\"assets/images/under-construction.jpg\"" alt="\"\"" width="\"611\"" height="\"500\"" /></p>


        Any ideas?
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          <p><img src=\"assets/images/under-construction.jpg\" alt=\"\" width=\"611\" height=\"500\" /></p>
          Your problem is that your server is configured with PHP using magic_quotes_gpc set to On. It adds the extra \ before every quote mark. You need to either turn that Off or use a stripslashes() function somewhere to get rid of them.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 18373 ☆ A M B ☆
            • 3,141 Posts
            There’s extra quotes (") being escaped within the string.... making HTML believe it is part of the link.

            <p><img src="\"assets/images/under-construction.jpg\"" alt="\"\"" width="\"611\"" height="\"500\"" /></p>


            should be

            <p><img src="assets/images/under-construction.jpg" alt="something here" width="611" height="500" /></p>


            Did you add in the quotes yourself?

            A simple test @ http://markhamstra.nl/modx/img-test.html works for me.
              Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

              Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
              • 5271
              • 5 Posts
              Ahh, weird. The extra quotes I thought was just a MODx thing - though it did seem a little excessive. How do I get rid of those?

              Also, with the stripslashes() tag, whereabouts should that go in the code?
                • 12379
                • 460 Posts
                Create a php.ini file in your root directory and add:

                magic_quotes_gpc = Off


                http://php.net/manual/en/security.magicquotes.disabling.php

                You may need to check with your web host that they allow you to add your own php.ini file.

                Strip slashes (weird, unless purposely added):

                http://au2.php.net/manual/en/function.stripslashes.php


                  Mostly harmless.
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  A custom php.ini file has to be included in every directory that has a .php script running; in our case you need one in the manager directory and in the MODx install root (since both run their own index.php files)
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 5271
                    • 5 Posts
                    Hi hotdiggity, sottwell.

                    I did a quick re-install just to eliminate any other possible causes - this time with the Sample Site included. Strangely, the images on that seem fine! (check here: http://www.worldimpactcentre.com/index.php?id=1). BUT, the \"\" is still shows up on TinyMCE-inserted images. No extra coding has been added on my end.

                    So, as suggested I added a php.ini file into both the root and manager directories with the line magic_quotes_gpc = Off but now I get this error:

                    Warning: session_start() [function.session-start]: SAFE MODE Restriction in effect. The script whose uid is 1375 is not allowed to access /tmp owned by uid 0 in /home/worldimp/public_html/manager/includes/config.inc.php on line 60

                    Fatal error: session_start() [<a href=’function.session-start’>function.session-start</a>]: Failed to initialize storage module: files (path: ) in /home/worldimp/public_html/manager/includes/config.inc.php on line 60


                    Looks like some kinda security counter-measure, so I guess this way’s a no-go.
                    Is there anything I could add/adjust on the server end? I have full access to the cpanel admin page fyi.
                      • 5271
                      • 5 Posts
                      Hi all, I don’t mean to pester but this is getting a bit urgent.

                      Is there any work around to get rid of the \"\" without getting that error message? huh