We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14020
    • 75 Posts
    Just released 2.4.1
    Fixed issue with Changelog, License, and Readme not showing with install:
      • 36551
      • 416 Posts
      I'm getting a series of errors every time the page loads with a set of images from a folder. There is one for each image. This rapidly filling up my error log.
      [2016-11-01 13:45:14] (ERROR @ /home/xxxxxx/public_html/core/model/modx/modx.class.php : 991) `0` is not a valid integer and may not be passed to makeUrl()
      [2016-11-01 13:45:14] (ERROR @ /home/xxxxxx/public_html/core/model/modx/modx.class.php : 1827) PHP warning: Missing argument 2 for modX::parseChunk(), called in /home/xxxxxx/public_html/core/cache/includes/elements/modsnippet/3.include.cache.php on line 134 and defined
      [2016-11-01 13:45:14] (ERROR @ /home/xxxxxx/public_html/core/model/modx/modx.class.php : 1827) PHP warning: Missing argument 2 for modX::parseChunk(), called in /home/xxxxxx/public_html/core/cache/includes/elements/modsnippet/3.include.cache.php on line 134 and defined

      This is the call on the page.
      [[!getImages?
       &getImages_Folder=`assets/images/hamline` 
       &getImages_Tpl =`getImages_Image_Tpl`
      ]]

      The Tpl is
      <div class="photos">
        <img src="[[+imgLink]]" alt="[[+imgName]]" />
      </div>

      I've commented out the line in snippet for getfolder.

      Modx 2.5.1 (new install)
      GetImages 2.4.1

      Any ideas?
        • 14020
        • 75 Posts
        Quote from: terrybarth at Nov 01, 2016, 05:52 PM
        I'm getting a series of errors every time the page loads with a set of images from a folder. There is one for each image. This rapidly filling up my error log.
        [2016-11-01 13:45:14] (ERROR @ /home/xxxxxx/public_html/core/model/modx/modx.class.php : 991) `0` is not a valid integer and may not be passed to makeUrl()
        [2016-11-01 13:45:14] (ERROR @ /home/xxxxxx/public_html/core/model/modx/modx.class.php : 1827) PHP warning: Missing argument 2 for modX::parseChunk(), called in /home/xxxxxx/public_html/core/cache/includes/elements/modsnippet/3.include.cache.php on line 134 and defined
        [2016-11-01 13:45:14] (ERROR @ /home/xxxxxx/public_html/core/model/modx/modx.class.php : 1827) PHP warning: Missing argument 2 for modX::parseChunk(), called in /home/xxxxxx/public_html/core/cache/includes/elements/modsnippet/3.include.cache.php on line 134 and defined

        This is the call on the page.
        [[!getImages?
         &getImages_Folder=`assets/images/hamline` 
         &getImages_Tpl =`getImages_Image_Tpl`
        ]]

        The Tpl is
        <div class="photos">
          <img src="[[+imgLink]]" alt="[[+imgName]]">
        </div>

        I've commented out the line in snippet for getfolder.

        Modx 2.5.1 (new install)
        GetImages 2.4.1

        Any ideas?

        You say you commented out the line in snippet for getfolder? I don't understand? Do you mean one of these 2 lines:
        // $folder = isset($_GET['folder']) ? $_GET['folder'] : ''; // use to get folder from URL
        $folder = $modx->getOption('getImages_Folder', $scriptProperties, 'assets/photos'); // use to get default folder, or from parameters
        If you comment out one you must uncomment the other.
          • 36551
          • 416 Posts
          Sorry, I probably didn't say that right.

          Here's what's in the snippet.
          /***** SET VARIABLES *****/
          // $folder = isset($_GET['folder']) ? $_GET['folder'] : ''; // use to get folder from URL
          $folder = $modx->getOption('getImages_Folder', $scriptProperties, 'assets/photos'); // use to get default folder, or from parameters


          I didn't mention that the all the correct images are being displayed.
            • 14020
            • 75 Posts
            With just a quick look at this and a search of the forums Garry Nutting pointed out (2.5 years ago) that I am using parseChunk where I should maybe be using getChunk. With that change it appears to work. I will take a closer look at this and see if everything still works correctly. If so I'll add the change. I wish this forum post had been copied to this page in the forums. I might have fixed this some time ago. I also should look at the logs more often. I rarely look at them when things are behaving as expected. smiley
              • 36551
              • 416 Posts
              As it happens, I have another site using getImages that is not generating any errors in the log. It is an older version, 2.3.2, and running a slightly different call.

              So I copied the snippet code from that site and created a new snippet. It still generated errors.

              I did notice the site with no errors is running php 7.0.12, where as the site generating errors is on 5.5.38. Both sites are running Modx 2.5.1
                • 14020
                • 75 Posts
                Quote from: terrybarth at Nov 04, 2016, 06:55 PM
                As it happens, I have another site using getImages that is not generating any errors in the log. It is an older version, 2.3.2, and running a slightly different call.

                So I copied the snippet code from that site and created a new snippet. It still generated errors.

                I did notice the site with no errors is running php 7.0.12, where as the site generating errors is on 5.5.38. Both sites are running Modx 2.5.1

                That's strange. I wonder what the diference is? In any case I've played with the code a bit and there is no noticeable drawback to using getChunk in place of pharseChunk so I will be updating all my snippets with that change ASAP. I am attempting to move from packMan to myComponent for creating the transport packages and that is why the delay in the update.
                  • 36551
                  • 416 Posts
                  Great. I'l watch for it.
                    • 14020
                    • 75 Posts
                    Just released Version 2.4.3 Just a few minor changes:
                    - Changed parseChunk to getChunk to fix log issue.
                    - Switched from packMan to myComponent for creating the transport file.
                    - After fixing an issue with getFolders I included it as a proper subpackage.
                    - Redid all documentation.
                    - made sure all parts work as described.
                      • 36551
                      • 416 Posts
                      Progress! I've installed the new package and parsechunk errors are all gone. Thank you!

                      I'm still getting these.modsnippet/3 is the getImages snippet
                      [2016-11-07 23:26:31] (ERROR @ /home/xxxxxx/public_html/core/model/modx/modx.class.php : 991) `0` is not a valid integer and may not be passed to makeUrl()
                      [2016-11-07 23:26:31] (ERROR @ /home/xxxxxx/public_html/core/cache/includes/elements/modsnippet/3.include.cache.php : 96) PHP warning: array_map() expects parameter 1 to be a valid callback, function 'filename' not found or invalid function name
                      [2016-11-07 23:26:31] (ERROR @ /home/xxxxxx/public_html/core/cache/includes/elements/modsnippet/3.include.cache.php : 96) PHP warning: array_multisort(): Argument #1 is expected to be an array or a sort flag


                      This is my call
                      [[!getImages?
                       &getImages_Folder=`assets/images/hamline` 
                       &getImages_Tpl =`getImages_Image_Tpl`
                       &getImages_Sort=`filename`
                      ]]


                      If this would be easier for you, I can give you manaqger access. Just PM me.