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

    Am trying to use Adaptive Images (http://adaptive-images.com/details.htm) on a MODX cloud site. I have created a snippet with the php script. I have added the text to the ht access file as they state. I have think linked to the snippet from the head of the template.

    However, when I now view my site, I just get a blank page. I have scoured the forum and see that I need to make the ai cache, which has been created, writable. I am not 100% sure how to do this, but looked at the chmod directory and it is currently set to 0755.

    Would be grateful if anyone can help.

    Best wishes, Missusdoubleyou
    • MODX Cloud does not run on Apache and therefore any .htaccess directives will be ignored. You'll need to find the nginx directive on the page for Adaptive Images and then follow the directions at the top of this page to implement them: https://modxcloud.com/userguide/using-modx-cloud/tools-and-configuration/web-rules-rewrites-redirects-tweaks.html

      I hope this helps.

      Jay
        Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. BlogTwitterLinkedInGitHub
        • 50485
        • 56 Posts
        Hi Jay!

        I tried what you suggested but I get this message on testing it - "There was an error with your rewrite rules. Please check the syntax and make sure you've entered them correctly. Errors: nginx: [emerg] duplicate location "/" in 23771.temp.conf:66 nginx: configuration file 23771.temp.conf test failed"

        The script that Adaptive Images recommends for nginx refers to the associated .php file. I have created a snippet using this script, but do I need to refer to it differently?

           location assets {
            }
            location ai-cache {
            }
            
            location / {
                rewrite \.(?:jpe?g|gif|png)$ /adaptive-images.php;
            }


        Thanks, Su
          • 19872
          • 1,078 Posts
          This is beyond me — but I found this within the adaptive-images documentation:

          You'll need to ensure you've got PHP running with nginx too, but that's outside of the scope of this site.
            • 50485
            • 56 Posts
            Hi mmcgee - is PHP not running on MODX cloud?!
              • 19872
              • 1,078 Posts
              Matt Wilcox the developer of Adaptive-Images had done this tweet.
              https://twitter.com/mattwilcox/status/193973641287958528

              Also found the same info at github related to an nginx rewrite rule
              https://github.com/MattWilcox/Adaptive-Images/issues/20
                • 50485
                • 56 Posts
                Hi mmcgee

                Thanks ever so for the links. The different re-write rule was accepted by MODX cloud. However, I am back to having a blank screen on any page! Could it be something to do with the fact that the re-write refers to adaptive-images.php, but in my head chunk I am referring to [[adaptive-images]]
                • Actually the adaptive images has nothing to do with MODX. The server, every time it sees a request for an image, loads the adaptive-images.php file instead of the requested image file. MODX doesn't get involved at all.

                  If you want to use a snippet, it would be in a resource with no template, and your rewrite rule would point to that resource's URL instead of the adaptive-images.php file. I haven't looked at how Adaptive Images works, so I'm not sure a snippet would even work at all.

                  A white-page means that there was a fatal PHP error that stops MODX, so you would need to look at your server's PHP error logs to find out just what the problem is.
                    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
                    • 50485
                    • 56 Posts
                    Hello Sottwell

                    Thanks for responding. I am using MODX cloud, so presume the servers are theirs.
                    • Then you can find your PHP error logs in your home directory, above the www directory.
                        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