Thanks Appa.
On Tue, Mar 20, 2012 at 2:38 PM, Antonio P.P. Almeida <appa@perusio.net>wrote:
> > Let me rephrase my Q :-)
> >
> > Can I find out the file size in a location directive?
> > -Quintin
>
> Using set_by_lua (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)';
> }
>
> Untested. This will give you the file size on the variable $img_file_size.
>
>
> --appa
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx