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

    i have a problem using getresources with phpthumbof to display a list of poster thumbnails linking to documents.

    the snippet call:

    [[getResources? &parents=`2` &tpl=`poster_row` &includeTVs=`1` &includeTVList=`start,poster` &processTVs=`1` &processTVList=`start,poster` &sortbyTV=`start` &showHidden=`1` &limit=`32` &tvPrefix=`` &sortdirTV=`ASC`]]


    the chunk:

    <li><a href="[[~[[+id]]]]" title="[[+pagetitle]]"><img src="[[+poster:phpthumbof=`w=140&h=200&zc=1&q=90`]]" alt="[[+pagetitle]]" /></a></li>


    the problem:

    the uploaded image files for tv 'poster' are quite big, because they are also in use for full view on another page, so the first time the snippet is called, it takes about 5-10 seconds to process it. on reload it takes only 1,5 seconds, because the thumbnails are pulled from cache.

    is there a way to get my images permanently from cache, even if the snippet calls for new or changed resources? maybe i'm wrong and there are alternatives for doing this.
      • 3109 ☆ A M B ☆
      • 894 Posts
      It will always take longer on the initial view of the image because phpthumb will generate the re-sized image the first time it is viewed and then place it in the cache.

      The only way to accomplish what you want is re-sizing the image before uploading it.
        Benjamin Marte
        Interactive Media Developer
        Follow Me on Twitter | Visit my site | Learn MODX
        • 22303 MODX Staff
        • 10,725 Posts
        Quote from: benmarte at Sep 18, 2012, 03:40 PM
        The only way to accomplish what you want is re-sizing the image before uploading it.
        Or immediately after uploading it, maybe with a plugin...hint, hint.
          • 24275
          • 4 Posts
          Quote from: opengeek at Sep 18, 2012, 04:44 PM

          Or immediately after uploading it, maybe with a plugin...hint, hint.

          like the manager is creating tv preview thumbs?
            • 24275
            • 4 Posts
            i think the best solution would be a possibility to render an uploaded image into different image-tv's, like: thumbnail_small, thumbnail_medium, thumbnail_large, original_image. but i got no clue how to work this out. meanwhile i'll solve my problem using the refreshCache Snippet to manually refill the cache.
              • 15558
              • 108 Posts
              1. Install pThumb

              2. Enable Resizer in System Settings > phpthumbof

              3. Replace
               [[+poster:phpthumbof=`w=140&h=200&zc=1&q=90`]]
              by
               [[+poster:phpthumbof? &useResizer=`1` &options=`w=140&h=200&zc=1&q=90`]]


              4. Freak - the - hell - out. I won't spoil about the result.

              5. Spread the word.

              Bonus : you can also replace your getResources calls with pdoResources (syntax is the same, if not easier about TVs) and win some more seconds.
                Sorry for that ⇧ , I'm no dev but I wanna try