Not so long ago, I told you how the storage and distribution of user images on Topface Developer Day (
presentation on speakerdeck ) is arranged in our
Topface . Pictures we cut on the fly in nginx using image_filter.
People are mostly elongated in the vertical direction and photos of themselves for the dating service make appropriate, the designers want little squares, and nginx cuts out people not exactly what people are interested in (I mean the face). Using the example of longcat, you get something like the following:
You have to live with it in the usual way: take it and add it yourself. As a result, I got a patch for the image_filter module, which can tell which side of the image you do not need to cut off the edges when crop occurs.
All good on github .
')
Customization
It's simple, you need to enter a directive in the location or server you need.
image_filter_offset {left,center,right} {top,center,bottom};
Illustrative examples
Vertical pictures
Original:
Align top:
image_filter_offset center top;
Center alignment (normal behavior):
image_filter_offset center center;
Align bottom:
image_filter_offset center bottom;
Horizontal pictures
Original:
Align left:
image_filter_offset left center;
Center alignment (normal behavior):
image_filter_offset center center;
Right alignment:
image_filter_offset right center;
For those who missed: a
link to github .