Welcome! Log In Create A New Profile

Advanced

Image_filter before proxy_store

Reinis Rozitis
May 22, 2009 11:17AM
Hello,
wanted a suggestion on such setup - the idea is to create on-the-fly image resizing and storing the thumbnails on the disk (kinda at
some level on-demand mirror with file altering and storing them in the same tree as parent host (rather than using
proxy_cache_path)).

The basic setup:

server {
root /data;

location ~* (.*)/small_(.*) {
error_page 404 = @small;
}

location @small {
internal;
image_filter resize 100 100;
proxy_pass http://imgstore$1/$2;
proxy_store on;
}
}


The idea is - if a request http://server/small_picture.jpg is made and the file doesnt exist on local storage is is passed to a
parent image store server which holds only 'picture.jpg', resized and stored locally..

The issue is that the 'small_picture.jpg' (actually the large version) is now saved before the image_filter kicks in and client
gets the thumbnail only on first request.


I could of course change the proxy_pass to make a request back to for example http://127.0.0.1/small/small_picture.jpg and then
define location /small {} which contains the resize and parent proxy_pass definition, but wanted to ask maybe if there is more
optimal solution rather than making a second request to nginx itself.

wbr
rr
Subject Author Posted

Image_filter before proxy_store

Reinis Rozitis May 22, 2009 11:17AM

Re: Image_filter before proxy_store

Anton Yuzhaninov May 26, 2009 11:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 131
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready