We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14020
    • 75 Posts
    Quote from: timbo_la at Feb 08, 2015, 11:06 AM
    Hi,

    I seem to have a problem which is similar to what tajdik was having. i have tried the solutions posted so far and getImages still doesn't display anything, it is not outputting any template code let alone images.

    I want to display images on my homepage. i have a getResources call which then displays a template for the corresponding post, in this case a photo gallery post.


    getResources call:

    ....
    <div id="content_inner">
    <div id="plinth_wrapper">
    [[!getResources?
    &showHidden=`1`
    &parents=`3,11,14`
    &tplCondition=`template`
    &conditionalTpls=`{"6":"frontpage-news-post","7":"frontpage-photos-post","9":"frontpage-events-post"}`
    &tpl=`frontpage-generic-post`
    &tvPrefix=`tv.`
    &includeTVs=`1`
    &processTVs=`1`
    &depth=`4`
    &limit=`6` 
    ]]
    </div> <!-- plinth_wrapper -->
    </div> <!-- content_inner END -->
    ....
    


    getImages call:

    ....
    <div class="cp_post_container">
    
    [[!getImages? 
    &getImages_Folder=`assets/photos` 
    &getImages_Ext=`*.jpg`
    &getImages_Tpl=`getImages_Tpl`
    &getImages_Limit=`6`
    &getImages_Offset=`8`
    &getImages_Width=`150`
    &getImages_Height=`100`
    &getImages_Border=`2`
    &getImages_Class=`img`
    ]]
    
    </div> <!-- cp_post_container END -->
    ....
    


    below is a template i got from this thread just to try it out.

    getImages_Tpl:

    <div class="photos">
    <a href="[[+imgLink]]" target="_blank">
    <img title="[[+image]]" src="[[+path]].thumbs/lr_[[+imgFile]]" alt="[[+imgLink]]" height="[[+height]]" width="[[+width]]">
    </a>
    </div>
    




    i am using:
    modx 2.3.2-pl
    getImages 2.3.1-pl

    i get these errors in the log:

    [2015-02-08 10:44:01] (ERROR @ /modx-2.3.2-pl/connectors/index.php) Resource URI 2011/ already exists for resource id = 100; skipping duplicate resource URI for resource id = 214
    [2015-02-08 10:44:01] (ERROR @ /modx-2.3.2-pl/connectors/index.php) Resource URI 2012/ already exists for resource id = 101; skipping duplicate resource URI for resource id = 215
    [2015-02-08 10:44:01] (ERROR @ /modx-2.3.2-pl/connectors/index.php) Resource URI 2013/ already exists for resource id = 108; skipping duplicate resource URI for resource id = 216


    This is my PHP:

    PHP Version 5.3.3



    If you need any other information, i will try to give it.

    Tim
    You have a little too much going on for me to be able to diagnose, such as the getResources call with tv's etc... If it were my system I would put in a page exactly as in the step by step instructions, make sure that works as expected and then slowly make the changes so that it works the way you need it to. That way you would be able to see where the program fails and have a better idea what is going wrong.
      • 38793
      • 18 Posts
      Thank you for the reply.

      After a few days away from this, I just re-visited it and got it working. Maybe I was missing something out when doing it before.

      I think fresh eyes and all that helped, sorry for bothering you with my original post.

      Thanks

      Tim
        • 14020
        • 75 Posts
        Quote from: timbo_la at Feb 14, 2015, 12:10 PM
        Thank you for the reply.

        After a few days away from this, I just re-visited it and got it working. Maybe I was missing something out when doing it before.

        I think fresh eyes and all that helped, sorry for bothering you with my original post.

        Thanks

        Tim
        No Problem. Great to hear it's working for you.
          • 37859
          • 34 Posts
          Great snippet ! Just what I was looking for.
          Works great, but I have one question :

          Is there a possibility to have random sorting ?

          I want to have the images displayed in a different order each time the page is loaded.

            • 14020
            • 75 Posts
            Quote from: bendy4 at Aug 07, 2015, 02:05 PM
            Great snippet ! Just what I was looking for.
            Works great, but I have one question :

            Is there a possibility to have random sorting ?

            I want to have the images displayed in a different order each time the page is loaded.


            Fun idea and surprisingly easy. Just add a new line in the ***set variables*** section after
            $pageLimit = ...
            $rSort = $modx->getOption('getImages_Random', $scriptProperties, 0); // Do we use random sorting
            Then I put an if statement at about line 102, after the if/else, to do the sorting.
            if ($rSort > 0) {
            shuffle($images);
            }

            Then you just need to add the variable to your snippet call.
            &getImages_Random=`1`
            I will make these changes to the next update but it may take a bit because I've got a lot on my plate this week.
              • 14020
              • 75 Posts
              Just releases 2.3.2 with the Random sort suggested by bendy4.
              No other changes so no need to update unless you want that feature.
              Thanks
                • 38850
                • 110 Posts
                I would also like the issue with the parseChunk() call to be fixed.

                The error log says "PHP warning: Missing argument 2 for modX::parseChunk()".

                It's in the getImages snippet on line 150:

                $page = $modx->parseChunk($page_tpl); //call the formatting chunk and fill with the results


                I have edited mine to this which prevents the error but not sure if it would cause any other problems.

                $page = $modx->parseChunk($page_tpl, $modx->placeholders); //call the formatting chunk and fill with the results


                Can this be fixed in the next version to stop the errors about missing argument? Another person suggested using getChunk as another possible solution.

                Thanks!
                  • 36551
                  • 416 Posts
                  Is there any particular trick to specifying a folder name that has spaces in the name?

                  If I specify:
                  &getImages_Folder=`assets/album/folder-name/

                  the images are displayed.
                  However if I specify
                  &getImages_Folder=`assets/album/folder name/
                  or
                  &getImages_Folder=`assets/album/folder%20name/

                  No images are displayed.

                  I'm trying to use an existing folder structure without having to rename anything.

                  Thanks.
                    • 14020
                    • 75 Posts
                    I did a little playing around and came up with this solution.
                    place this:

                    $images = str_replace(' ', '%20', $images);

                    into the getImages Snippit right before the comment line that reads:

                    /***** CREATE THE IMAGE SECTION FOR OUR PAGE *****/

                    This will rewrite the path to be readable by php.

                    I will do some testing to make sure this does not break anything else and if not I will add it to the next release.


                    Quote from: terrybarth at Dec 01, 2015, 06:53 PM
                    Is there any particular trick to specifying a folder name that has spaces in the name?

                    If I specify:
                    &getImages_Folder=`assets/album/folder-name/

                    the images are displayed.
                    However if I specify
                    &getImages_Folder=`assets/album/folder name/
                    or
                    &getImages_Folder=`assets/album/folder%20name/

                    No images are displayed.

                    I'm trying to use an existing folder structure without having to rename anything.

                    Thanks.
                      • 14020
                      • 75 Posts
                      I'll look into it. I don't think it will cause any issues. BTW there was some issue with notifications on this forum and I was just now made aware that you and others had asked questions and sent PMs. I was not ignoring anyone and make it a point to answer any question ASAP even if I can't solve the issue I would at least like people to know that I am concerned and at least looking at the problem. Thanks for bringing this to my attention.

                      Quote from: vigilante at Sep 17, 2015, 05:39 PM
                      I would also like the issue with the parseChunk() call to be fixed.

                      The error log says "PHP warning: Missing argument 2 for modX::parseChunk()".

                      It's in the getImages snippet on line 150:

                      $page = $modx->parseChunk($page_tpl); //call the formatting chunk and fill with the results


                      I have edited mine to this which prevents the error but not sure if it would cause any other problems.

                      $page = $modx->parseChunk($page_tpl, $modx->placeholders); //call the formatting chunk and fill with the results


                      Can this be fixed in the next version to stop the errors about missing argument? Another person suggested using getChunk as another possible solution.

                      Thanks!