We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16551 ☆ A M B ☆
    • 54 Posts
    Here's my problem:

    I have a cached snippet in my template.
    In this snippet I use runSnippet to run phpThumbOf to process some images.
    $output = $modx->runSnippet('phpthumbof', array(
    	'input' => $image,
    	'options' => 'w='.$width.'&h='.$height.'&zc='.$zC.'&f=jpg&dpi=72&q=95&far=0&aoe=1'
    ));

    The problem is that, whenever a resource is saved, the cache is being cleared and (although I deactivated the plugin phpThumbOfCacheManager, so the processed images are still existing in assets/components/phpthumbof/cache/) the pages take very long do rebuild. Pretty clear, because runSnippet is always executed and the result is never cached (http://rtfm.modx.com/revolution/2.x/developing-in-modx/other-development-resources/class-reference/modx/modx.runsnippet).

    1. How would you proceed here?

    2. Instead of running phpThumbOf I tried running getCache and it looks like the images are actually coming from the cache - even after saving resources.
    $output = $modx->runSnippet('getCache', array(
    	'element' => 'phpthumbof',
    	'input' => $image,
    	'options' => 'w='.$width.'&h='.$height.'&zc='.$zC.'&f=jpg&dpi=72&q=95&far=0&aoe=1'
    ));

    Is this a way to solve this? I don't really understand how getCache works and what it does.
      • 4172
      • 5,888 Posts
      this sounds like a bug with phpthumbof.
      As soon, as a thumb is in the cache, phpthumbof shouldn't try to regenerate the thumb

      you can try to replace phpthumbof with pthumb
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 16551 ☆ A M B ☆
        • 54 Posts
        Hey Bruno,
        thanks. I just replaced phpthumbof with pthumb and it seems to be faster indeed.

        But I honestly have some problems to really understand how caching works in MODX. Everything in my templates is cached, but it's still kind of slow... Looks like I have to do some more reading about caching and espacially getCache.