description for "crop" directive in ngx_http_image_filter_module's document is not correct
Homutov Vladimir
vl at nginx.com
Mon Oct 29 08:28:47 UTC 2012
On Mon, Oct 29, 2012 at 11:47:02AM +0800, chen cw wrote:
> Hi,
> we think the description for "crop" directive in
> ngx_http_image_filter_module's document is not correct, or at least not
> clear. It says "proportionally reduces an image to the size of the largest
> side". we have tested and now believes it should be not "the largest
> side", but "the smallest side".
>
Hi!
The 'largest side' is related to the arguments of the 'crop'
directive, not the source image size.
With this in mind, the description is correct.
For example,
command 'crop 600x50' for source image 640x480 will:
1) proportionally reduce largest (600 - horizontal) side: 640->600
2) crops extraneous edges by another side - vertical: 480->50
the result is that image got reduced horizontally a bit (proportionally)
and cropped by vertical side (50 center pixels left).
command 'crop 600x50' for 480x640 image will give 480x50:
1) proportionally reduce horizontal side (no actions, 480 < 600
requested)
2) leave 50 center pixels on another side
command 'crop 50x600' for 640x480 image will give 50x480:
1) largest side is 600 (vertical), no actions (requested 600 < 480
actual)
2) another side is cropped to 50 pixels.
More information about the nginx-devel
mailing list