Imagick resizeImage():当不指定Imagick中最大高度时使用什么参数?

发布于 2025-01-25 00:28:41 字数 392 浏览 4 评论 0 原文

我正在使用Imagick 3.7.0根据ImageMagick 7.0.10-23 Q16 x86_64

在以前版本的Imagick中,我可以调整指定宽度的图像大小,但使用此命令的高度无限,其中$ width是特定的尺寸,但无效旨在表示高度的无限含义:

justizeImage($ width,null,Imagick :: Filter_lanczos,1);

使用我加载的新Imagick使用用于使用PHP 8.1在我的服务器上:

imagick :: resizeImage():将null传递到int类型的参数#2($行)被弃用

在这种情况下向第二个参数提供的适当参数是什么?

非常感谢!

I'm using imagick 3.7.0 compiled against ImageMagick 7.0.10-23 Q16 x86_64

In previous versions of imagick, I could resize an image with the width specified but the height unlimited using this command, where $width is a specific size but null is intended to mean unlimited for the height:

resizeImage($width, null, imagick::FILTER_LANCZOS, 1);

With the new imagick I've loaded to use PHP 8.1, the null is throwing an error on my server:

Imagick::resizeImage(): Passing null to parameter #2 ($rows) of type int is deprecated

What is the proper argument to supply to the second parameter in this case?

Many thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

叹沉浮 2025-02-01 00:28:41

如果您通过 $ bestfit = true ,则图像保留了比例。 $ width $ height 被视为Max-With和Max-Height。因此,如果您通过一个非常大的 $ height ,则图像大小将受到限制为 $ width 。例如:

resizeImage($width, 999999, imagick::FILTER_LANCZOS, true);

请参阅: http://www.phpimagick.com/imagick/imagick/resizeimage?width = 200&height = 500& amp;

if you pass $bestFit=true, the image keeps the scale. $width and $height are treated as max-with and max-height. So if you pass a very large $height, the image-size will be limited be the provided $width. For example:

resizeImage($width, 999999, imagick::FILTER_LANCZOS, true);

See: http://www.phpimagick.com/Imagick/resizeImage?width=200&height=500&blur=1&filter_type=Lanczos&crop=Disabled&best_fit=Enabled&image_path=Lorikeet

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文