We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 48421
    • 19 Posts
    Hi

    If I upload images into the Gallery Add-on or into the 'assets' folder via TinyMCE, I'm finding that browser caching isn't configured by default. Is this something to be configured within System Settings or does this required an Add-on for this functionality?

    I've been using Google PageSpeed Insights to test.

    Regards

    Phillip
      • 1343 ☆ A M B ☆
      • 2,213 Posts
      Hello Phillip,

      Can you please confirm what version of Gallery you have installed? It looks like the current release (http://modx.com/extras/package/gallery) has the fix you need.
        Patrick | Server Wrangler
        About Me: Website | Tweets |  MODX Hosting
        • 48421
        • 19 Posts
        Hi

        I'm using Gallery version 1.7.0-pl on MODX version 2.3.2, hosted on MODX Cloud. I'm using the phpthumbof add-on with the [[+image_absolute]] placeholder in Gallery which give's me an image src similar to below:

        <img src="/assets/components/phpthumbof/cache/163.8b02d6c2a07886071f2c93cb5e434b924.jpg" alt="" />


        If I run page speed insights on the page that is generated, PageSpeed Insights highlights that all images from Gallery, or uploaded directly into the file system and shows something similar to the following:

        /…63.8b02d6c2a07886071f2c93cb5e434b924.jpg (expiration not specified)

        I've tried using the [[+image_thumbnail]] placeholder too which outputs something like that shown below, but is also flagged by PageSpeed Insights.

        <img src="/assets/components/gallery/connector.php?action=web/phpthumb&ctx=web&w=110&h=80&zc=1&far=C&q=90&src=%2Fassets%2Fgallery%2F4%2F163.jpg" alt="" />


        Are there any configuration options within System Settings, or via another package that will allow the configuration of caching on these images?

        Regards

        Phillip
          • 42046
          • 436 Posts
          You can set local browser cache rules in htaccess:

          ExpiresActive On
          ExpiresByType image/gif A2592000
          ExpiresByType image/jpeg A2592000
          ExpiresByType image/png A2592000
          ExpiresByType image/ico A2592000
          BrowserMatch "MSIE" brokenvary=1
          BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
          BrowserMatch "Opera" !brokenvary
          SetEnvIf brokenvary 1 force-no-vary
            • 1343 ☆ A M B ☆
            • 2,213 Posts
            Can you try using pThumb instead of phpThumbOf? I would recommend enabling pThumb's cache and Resizer support (both in system settings). If I recall correctly phpThumbOf has been sunset (no longer supported) at this point in time.
              Patrick | Server Wrangler
              About Me: Website | Tweets |  MODX Hosting