On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Quote from: kilroy at Aug 27, 2014, 05:37 AM
    Quote from: BobRay at Aug 26, 2014, 06:35 PM
    You need to comment out line2 (by adding // at the beginning), and remove the // from the beginning of line 3 to uncomment it.

    Since you're sending the folder value as a property, it won't be in the $_GET array, so you need to get it from the $scriptProperties array with $modx->getOption().

    Thank you for this suggestion. I tried, but it returned 0 image.
    Removing the &getImages_Paging =`0` parameters now results in showing: 9 Photos - Page of. But no image is displayed. I will try to modify the templates to get it going.

    Try to this in you call:
    [[!getImages?
    &getImages_Folder=`assets/images/expositions/expo`
    &getImages_Paging =`0`
    &getImages_Ext =`jpg,png`
    ]]

    Remove the "*." in getImages_Ext

    Murias
    • I found what was wrong: the default $image_tpl mentioned in the snippet does not exist. It is named getPhotos_Image_Tpl instead of getImages_Image_Tpl. With the right template it now works.
      • One quick tip: it would be nice to have an option to change the image sorting.

        By default it is by filemtime.
        I changed it to filename, which is easier to handle, but it could be an option for the snippet
        array_multisort(array_map('filename', $allImages)
        • Great Idea! I'll make that change and fix the template issue next week when I have a few minutes to tinker with it.


          Quote from: kilroy at Aug 27, 2014, 09:04 AM
          One quick tip: it would be nice to have an option to change the image sorting.

          By default it is by filemtime.
          I changed it to filename, which is easier to handle, but it could be an option for the snippet
          array_multisort(array_map('filename', $allImages)
          • OK so it's been a month and a week instead of just a week. I hate it when real life gets in the way of my codding. smiley
            Anyway the new version 2.3.0 is up and ready for download and this time it will not write over your chunks unless of course you named them with a prefix of example_ .
            I added some examples to the docs folder as well and carefully went through the code to make sure it works as stated "out of the box".
            Hope you enjoy it. As always I would be grateful for any and all suggestions for improvements.
            Support/Comments should be posted here.
            • Sorry, but I have a problem with your new version 2.3.1
              I've updated your old version (1.1.0) to this current and have a big problem - it can't get images from any folder! I've tried all types, folders, using default route and with &getImages_Folder variable, but still can't receive any result. It takes an html from getImages_Page_Tpl (by default), but don't get images from folder, using [[+photos]]. What's the problem, do you know?
              • Not sure what it could be. Could you send me the call you are using along with the template chunks you have.
                • Hi Jerry

                  This is a great snippet; thank you very much! I've got it working perfcetly when i've entered the path in manually (assets/media/images/case_studies/test-case-study)

                  I have one questions though... if I try to use it with a TV that has a @DIRECTORY binding it doesn't work.

                  E.g:

                  [[!getImages?
                  &getImages_Folder=`[[*folder_casestudies]]`
                  &getImages_Paging =`0`
                  &getImages_Image_Tpl =`getimages_thumb`
                  &getImages_Ext =`jpg,jpeg,gif,png,JPG,JPEG,GIF,PNG`
                  ]]
                  


                  I'd really appreciate anyones help on this, i'll even buy you a beer! smiley

                  Cheers
                  • Hi everyone! I've solved this, nothing spectacular I just changed my TV call to

                    @DIRECTORY assets/media/images/case_studies


                    instead of

                    @DIRECTORY /assets/media/images/case_studies


                    Have a great weekend! smiley
                    • Quote from: tajdik at Dec 11, 2014, 09:09 PM
                      Hello,
                      sorry for disturbing You, but I have problem with getImages (2.3.1). Im newbie to modx and dont have programing skills at all, so a cant handle it by my self.

                      Error log:
                      shortened path.../core/cache/includes/elements/modsnippet/43.include.cache.php : 92) PHP warning: array_map() [<a href="function.array-map">function.array-map</a>]: Argument #2 should be an array
                      shortened path.../core/cache/includes/elements/modsnippet/43.include.cache.php : 92) PHP warning: array_multisort() [<a href="function.array-multisort">function.array-multisort</a>]: Argument #1 is expected to be an array or a sort flag
                      shortened path.../core/cache/includes/elements/modsnippet/43.include.cache.php : 96) PHP warning: array_slice() expects parameter 1 to be array, boolean given
                      shortened path.../core/cache/includes/elements/modsnippet/43.include.cache.php : 103) PHP warning: Invalid argument supplied for foreach()
                      shortened path.../core/model/modx/modx.class.php : 1830) PHP warning: Missing argument 2 for modX::parseChunk(), called in /data/web/virtuals/12505/virtual/www/work/MODXhacienda/core/cache/includes/elements/modsnippet/43.include.cache.php on line 143 and defined
                      shortened path.../core/cache/includes/elements/modsnippet/43.include.cache.php : 92) PHP warning: array_map() [<a href="function.array-map">function.array-map</a>]: Argument #2 should be an array
                      shortened path.../core/cache/includes/elements/modsnippet/43.include.cache.php : 92) PHP warning: array_multisort() [<a href="function.array-multisort">function.array-multisort</a>]: Argument #1 is expected to be an array or a sort flag
                      shortened path.../core/cache/includes/elements/modsnippet/43.include.cache.php : 96) PHP warning: array_slice() expects parameter 1 to be array, boolean given
                      shortened path.../core/cache/includes/elements/modsnippet/43.include.cache.php : 103) PHP warning: Invalid argument supplied for foreach()
                      shortened path.../core/model/modx/modx.class.php : 1830) PHP warning: Missing argument 2 for modX::parseChunk(), called in /data/web/virtuals/12505/virtual/www/work/MODXhacienda/core/cache/includes/elements/modsnippet/43.include.cache.php on line 143 and defined

                      I found this solution for parseChunk:
                      http://forums.modx.com/thread/91148/getimages-missing-argument-in-modx-parsechunk

                      But cant fix rest.

                      Can you help me?
                      Thanks a lot.

                      Not sure I can help but I will try. I completely missed the http://forums.modx.com/thread/91148/getimages-missing-argument-in-modx-parsechunk thread as it was not posted in http://forums.modx.com/thread/81713/support-comments-for-getimages and would not have been much help there as I have never used this add-on in that way. Back to your question though: could you send me the snippit call you are using? I've also moved this to the support thread so that others can see it and help.