WordPress.org

Support

Support » Plugins and Hacks » New Nine Adaptive Images » NGINX rules for Adaptive Images?

NGINX rules for Adaptive Images?

Viewing 6 replies - 1 through 6 (of 6 total)
  • This is working for me:

    location / {
        try_files $uri $uri/ /index.php?$args;
        if ($request_uri ~ "wp-content/uploads"){
            rewrite \.(?:jpe?g|gif|png)$ /wp-content/plugins/new-nine-adaptive-images/adaptive-images.php last;
        }
    }

    You may have to manually create wp-content/uploads/ai-cache/ and give it appropriate write permissions.

    Been testing this rule but doesn’t seem to be working. Checking the site from a phone, the only directory that’s ever created is for the 1200 breakpoint. And even then, I’ve only gotten two images to be created.

    If you’re seeing adaptive images, the rule is working. It’s the plugin that deals with different breakpoints. I added several and it resulted in the appropriate creation of the relevant directories.

    Definitely not working. Not sure how those two images were even created but no other images have been created since.

    That’s a pity it doesn’t work for you. I just tested my install again with this image:

    identify Aerial04.jpg
    Aerial04.jpg JPEG 3200x2000 3200x2000+0+0 8-bit sRGB 4.189MB 0.000u 0:00.000

    Once uploaded to my WordPress site and viewed on my 1920 width monitor:

    identify ai-cache/1900/wp-content/uploads/2014/01/Aerial04.jpg
    ai-cache/1900/wp-content/uploads/2014/01/Aerial04.jpg JPEG 1900x1188 1900x1188+0+0 8-bit DirectClass 446KB 0.020u 0:00.030

    Then on my Nexus 4:

    identify ai-cache/768/wp-content/uploads/2014/01/Aerial04.jpg
    ai-cache/768/wp-content/uploads/2014/01/Aerial04.jpg JPEG 768x480 768x480+0+0 8-bit DirectClass 82.9KB 0.000u 0:00.009

    So as you can see. Definitely working.

    As a follow up, I was tweaking my nginx vhost conf today and added this:

    # Aggressive caching for static files
    location ~* \.(asf|asx|wax|... big list of extensions)$ {
            expires 31536000s;
            access_log off;
            log_not_found off;
            add_header Pragma public;
            add_header Cache-Control "max-age=31536000, public";
    }

    It stopped adaptive images working. I’ve taken it back out for now and adaptive images work again.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘NGINX rules for Adaptive Images?’ is closed to new replies.
Skip to toolbar