jpeg_filter_dropon_align
`jpeg_filter_dropon_align` 指令指定覆盖图像在 JPEG 上的对齐方式,基于所给的垂直和水平对齐选项确定其位置。
NGINX JPEG filter module
·
location
语法jpeg_filter_dropon_align vertical horizontal;
默认值center center
上下文location
参数2
说明
jpeg_filter_dropon_align 指令在 JPEG 图像处理的上下文中使用,用于控制在过滤过程中覆盖图像相对于基础 JPEG 图像的位置。该指令接受两个参数:第一个参数指定垂直对齐(选项为 top、center、bottom),第二个参数定义水平对齐(选项为 left、center、right)。此配置允许精确放置覆盖元素,例如徽标或水印,在目标 JPEG 图像上。
默认情况下,垂直和水平对齐均设置为 center,这会将覆盖图像放置在 JPEG 的正中。当选择不同的对齐选项时,覆盖将相应调整,帮助用户在无需修改原始文件的情况下动态定制图像外观。对于基于用户输入或偏好的需要动态图像处理的 Web 应用,此功能尤其有用。
配置示例
location /images/ {
jpeg_filter on;
jpeg_filter_dropon_align bottom right;
jpeg_filter_dropon_file /path/to/logo.png;
}⚠
确保覆盖图像的尺寸适当,以避免出现意外结果。
⚠
在 top, center, bottom, left, right 之外使用选项会导致错误。
⚠
错误的覆盖图像路径会导致 JPEG 处理失败。