-
-
Save Fastidious/c9aa898f8e09dbf0f351 to your computer and use it in GitHub Desktop.
On the fly image resizing with image_filter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# On the fly resizing of images inside /images/*/ | |
# based on query string "width" and "height" parameters | |
location ~ /images/(.+)/ { | |
set $width -; | |
set $height -; | |
set $entity $1; | |
if ($arg_width) { | |
set $width $arg_width; | |
} | |
if ($arg_height) { | |
set $height $arg_height; | |
} | |
image_filter resize $width $height; | |
image_filter_buffer 128M; | |
random_index on; | |
if (!-e $request_filename) { | |
rewrite ^ /images/$entity/; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment