Last active
August 29, 2015 14:02
-
-
Save tsertkov/cab97e3b3536bc9973ac 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