Skip to content

Instantly share code, notes, and snippets.

@netProphET
Created November 2, 2013 12:10
Show Gist options
  • Save netProphET/7278295 to your computer and use it in GitHub Desktop.
Save netProphET/7278295 to your computer and use it in GitHub Desktop.
phpThumbStatCache rewrite rules for MODX Cloud
location ~ ^/i/(.*) {
error_log /c0324/log/image.log notice;
rewrite_log on;
set $phptfn $1;
rewrite ^(.*?)\/w\/(\d+)\/(.*)$ $1/$3?w=$2&$args;
rewrite ^(.*?)\/h\/(\d+)\/(.*)$ $1/$3?h=$2&$args;
rewrite ^(.*?)\/new\/(\d+)\/(.*)$ $1/$3?new=$2&$args;
rewrite ^(.*?)\/wp\/(\d+)\/(.*)$ $1/$3?wp=$2&$args;
rewrite ^(.*?)\/hp\/(\d+)\/(.*)$ $1/$3?hp=$2&$args;
rewrite ^(.*?)\/w1\/(\d+)\/(.*)$ $1/$3?w1=$2&$args;
rewrite ^(.*?)\/h1\/(\d+)\/(.*)$ $1/$3?h1=$2&$args;
rewrite ^(.*?)\/ws\/(\d+)\/(.*)$ $1/$3?ws=$2&$args;
rewrite ^(.*?)\/hs\/(\d+)\/(.*)$ $1/$3?hs=$2&$args;
rewrite ^(.*?)\/f\/(\d+)\/(.*)$ $1/$3?f=$2&$args;
rewrite ^(.*?)\/q\/(\d+)\/(.*)$ $1/$3?q=$2&$args;
rewrite ^(.*?)\/sx\/(\d+)\/(.*)$ $1/$3?sx=$2&$args;
rewrite ^(.*?)\/sy\/(\d+)\/(.*)$ $1/$3?sy=$2&$args;
rewrite ^(.*?)\/sw\/(\d+)\/(.*)$ $1/$3?sw=$2&$args;
rewrite ^(.*?)\/sh\/(\d+)\/(.*)$ $1/$3?sh=$2&$args;
rewrite ^(.*?)\/zc\/(\d+)\/(.*)$ $1/$3?zc=$2&$args;
rewrite ^(.*?)\/bg\/(\d+)\/(.*)$ $1/$3?bg=$2&$args;
rewrite ^(.*?)\/bc\/(\d+)\/(.*)$ $1/$3?bc=$2&$args;
rewrite ^(.*?)\/fltr\/(\d+)\/(.*)$ $1/$3?fltr=$2&$args;
rewrite ^(.*?)\/md5s\/(\d+)\/(.*)$ $1/$3?md5s=$2&$args;
rewrite ^(.*?)\/xto\/(\d+)\/(.*)$ $1/$3?xto=$2&$args;
rewrite ^(.*?)\/ra\/(\d+)\/(.*)$ $1/$3?ra=$2&$args;
rewrite ^(.*?)\/ar\/(\d+)\/(.*)$ $1/$3?ar=$2&$args;
rewrite ^(.*?)\/sfn\/(\d+)\/(.*)$ $1/$3?sfn=$2&$args;
rewrite ^(.*?)\/aoe\/(\d+)\/(.*)$ $1/$3?aoe=$2&$args;
rewrite ^(.*?)\/iar\/(\d+)\/(.*)$ $1/$3?iar=$2&$args;
rewrite ^(.*?)\/far\/(\d+)\/(.*)$ $1/$3?far=$2&$args;
rewrite ^(.*?)\/dpi\/(\d+)\/(.*)$ $1/$3?dpi=$2&$args;
rewrite ^(.*?)\/sia\/(\d+)\/(.*)$ $1/$3?sia=$2&$args;
rewrite ^(.*?)\/maxb\/(\d+)\/(.*)$ $1/$3?maxb=$2&$args;
rewrite ^(.*?)\/down\/(\d+)\/(.*)$ $1/$3?down=$2&$args;
rewrite ^\/i\/(.*)$ /assets/components/phpthumbstatcache/phpThumbStatCache.php?phptfn=$phptfn&src=/$1 last;
}
location / {
try_files $uri $uri/ @modx-rewrite;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment