I have a script named gallery.php the behaviour I am looking for is the following
url: http://mysite.com/images/gallery/sample.jpg
rewrite: http://mysite.com/images/gallery/gallery.php?src=sample&thumb=
url: http://mysite.com/images/gallery/thumb/sample.jpg
rewrite: http://mysite.com/images/gallery.php?src=sample&thumb=thumb
So the gallery.php script when called with thumb=thumb will return the jpg resized to 30x10, and when called without the thumb will retrun the image reszied to 600x200.
The apache rewrite rule is
rewrite ^(thumb/)?(.*)\.jpg$ gallery.php?src=$2&thumb=$1
I think I am on the right track what I have tried to do with nginx is the folllowing:
location ~^/gallery/thumb/(.*)\.jpg$ {
fastcgi_pass unix:/tmp/fastcgi.sock;
fastcgi_param SCRIPT_FILENAME /var/www/testalmar/httpdocs/images/gallery/gallery.php;
fastcgi_param QUERY_STRING src=$1&thumb=thumb;
}
location ~^/gallery/(.*)\.jpg$ {
fastcgi_pass unix:/tmp/fastcgi.sock;
fastcgi_param SCRIPT_FILENAME /var/www/testalmar/httpdocs/images/gallery/gallery.php;
fastcgi_param QUERY_STRING src=$1;
}
Which is not working. I am still missing something. Any suggestions on how to rewrite this?