Liip - 仅当图像大于预期时才调整图像大小

Liip - Resize image only if bigger than expected

我正在使用 Symfony 4.2 和 Liip Imagine 捆绑包。 我有一个这样的过滤器:

live_feed_message:
    jpeg_quality:          40
    png_compression_level: 9
    filters:
      relative_resize:
        widen: 1024

但是如果发送的图像小于 1024px,它会调整到 1024px。

我想要一个可以调整图像大小的滤镜以防图像更大。

我进行了搜索,但没有找到任何解决方案。 有人遇到过这个问题吗?

感谢您的帮助

好的,我找到了解决方案。我已经尝试过了,但我认为不正确。 现在它正在工作。不要使用 relative_resize 过滤器,而是使用 downscale 过滤器。

文档:

The built-in downscale filter performs sizing transformations (specifically image down-scaling). This filter exposed a number of down scale options which may be used to configure its behavior.

https://symfony.com/doc/2.0/bundles/LiipImagineBundle/filters/sizing.html#relative-resize-options