我在 PHP
中使用了 imagepng
函数来调整图片大小。在当前代码中,我没有指定 quality
参数。
imagepng($im_dest, $destfile);
但现在我想使用它并根据用户需求提高或降低质量。为此,我需要知道此函数中质量参数的默认值是多少,但不幸的是,我无法在 php.net 网站上找到它。
description of imagepng function in the official website of php
你知道什么是默认
值吗? quality
参数是否对输出大小和质量有很大影响?
还有一个问题:在其他地方,我调整了上传图像的大小(到它们的原始大小)以确保没有任何恶意脚本附加到它上面。这是一个好的做法还是没有必要?
非常感谢您的帮助。
最佳答案
当我阅读一些用户贡献的笔记时,我发现了这个并说默认质量设置为 6。
from mhorne69 at gmail dot com
from php source (gd.h):
2.0.12: Compression level: 0-9 or -1, where 0 is NO COMPRESSION at all, 1 is FASTEST but produces larger files, 9 provides the best compression (smallest files) but takes a long time to compress, and -1 selects the default compiled into the zlib library. Conclusion: Based on the Zlib manual (http://www.zlib.net/manual.html) the default compression level is set to 6.
我希望这能回答你的问题:)
关于php - `quality` 函数 `imagepng` 中 (`PHP` 参数的默认值是多少)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25924818/