Join the community today
Become a Member

centminmod/optimise-images

Discussion in 'Add Ons' started by Matt Williams, Apr 11, 2022.

  1. Matt Williams

    Matt Williams WordPress Fanatic

    537
    104
    43
    Nov 22, 2014
    Virginia, USA
    Ratings:
    +157
    Local Time:
    2:30 PM
    latest
    10
  2. eva2000

    eva2000 Administrator Staff Member

    50,852
    11,782
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,234
    Local Time:
    5:30 AM
    Nginx 1.25.x
    MariaDB 10.x
    It should still work especially on Centmin Mod installs. But I haven't tested it in a while and well it's provided as is :)
     
  3. JoeDer

    JoeDer Member

    82
    19
    8
    Feb 22, 2015
    Ratings:
    +48
    Local Time:
    9:30 PM
    Nginx 1.21.x
    MariaDB 10.3.x
    Regarding to this article, could the following method work with CMM?
    cwebp | WebP | Google Developers

    A cronjob:
    Code (Text):
    40 2 * * * find /home/nginx/domains/domain.com/public/wp-content/uploads/202* -iname "*.jpg" -cmin -1440 -exec cwebp -quiet -q 80 {} -o {}.webp \;
    

    Nginx rewrites:
    Code (Text):
    location ~* "wp-content\/uploads\/(.*.(?:png|jpe?g))" {
        add_header Vary Accept;
        set $image_path $1;
        if ($http_accept !~* "webp") {
        break;
      }
        try_files /wp-content/uploads/$image_path.webp $uri =404;
    }
    
     
  4. eva2000

    eva2000 Administrator Staff Member

    50,852
    11,782
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,234
    Local Time:
    5:30 AM
    Nginx 1.25.x
    MariaDB 10.x
    It could in theory but you'd want to test either method on test install first to be 100% sure. Especially, if you use Cloudflare in front of your site.