10up/image-generator

Name: image-generator

Owner: 10up

Description: Generates missed thumbnails for images on the fly.

Created: 2015-07-07 16:42:19.0

Updated: 2017-06-21 09:12:41.0

Pushed: 2015-09-29 09:33:33.0

Homepage:

Size: 2513

Language: PHP

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Image Generator

Nginx config
tion ~ \.(gif|jpg|png) {
try_files $uri @img_proxy;


tion @img_proxy {
rewrite ^(.*)$ /wp-admin/admin-ajax.php?action=generate_image;

Amazon S3 config

To make it working with Amazon S3 you need to enable website hosting for your bucket in S3 console and update redirection rules by adding following snippet:

tingRules>
<RoutingRule>
    <Condition>
        <HttpErrorCodeReturnedEquals>403</HttpErrorCodeReturnedEquals >
    </Condition>
    <Redirect>
        <HostName>yousite.com</HostName>
        <ReplaceKeyPrefixWith>wp-admin/admin-ajax.php?action=generate_image&amp;provider=aws&amp;image=</ReplaceKeyPrefixWith>
        <HttpRedirectCode>302</HttpRedirectCode>
    </Redirect>
</RoutingRule>
utingRules>

Please, pay attention to the HttpErrorCodeReturnedEquals parameter. It might accept either 403 or 404 code depending on a bucket settings. Also if you use S3 Uploads plugin, then you need to use S3Uploads provider name instead of aws as shown above. Finally if you stick with aws provider, then you need to define ACCESS KEY, SECRET, REGION and BUCKET constants in your wp-config.php file:

ne( 'AWS_ACCESS_KEY_ID', '...' );
ne( 'AWS_SECRET_ACCESS_KEY', '...' );
ne( 'AWS_S3_REGION', '...' );
ne( 'AWS_S3_BUCKET', '...' );

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.