Created
March 20, 2012 09:17
-
-
Save perusio/2133228 to your computer and use it in GitHub Desktop.
Revisions
-
perusio renamed this gist
Mar 20, 2012 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
perusio created this gist
Mar 20, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ ## Get the size of the image file using Lua. ## Cf. http://wiki.nginx.org/HttpLuaModule#set_by_lua. location ~* \.(?:gif|jpe?g|png)$ { set_by_lua $img_file_size ' function fsize (file) local current = file:seek() -- get current position local size = file:seek("end") -- get file size file:seek("set", current) -- restore position return size end fsize(ngx.var.request_filename)'; }