具有质量因数的无脂肪图像转储
fat-free image dump with quality factor
我尝试指定 Fatfree 图像处理的品质因数。根据文档(https://fatfreeframework.com/image#dump),转储方法可能采用整数值来指定质量:
$img->dump($fileType, 75) // $filetype is 'jpeg'
但我收到以下错误:
imagejpeg(): Invalid 2nd parameter, it must [sic] a filename or a stream
[...base.php:2032] Base->error(500,'imagejpeg(): Invalid 2nd parameter, it
must a filename or a stream')
[...index.php:712] Image->dump('jpeg', 75)
将质量因子作为字符串而不是 int 传递可以消除消息,但生成的图像随后为空。
(我知道 jpeg 和 png 转储使用不同的 quality/compression 率值。)
知道我的错误在哪里吗?谢谢,
文档和库之间存在矛盾。该库需要一个额外的 NULL
参数,与本机 imagejpeg() 函数完全一样。
这个已经是fixed now in the framework, so you can download the edge版本的框架了,还是等下一个版本吧。
总结:
F3 <= 3.5.1
$img->dump($fileType, NULL, 75)
F3 > 3.5.1
$img->dump($fileType, 75)
我尝试指定 Fatfree 图像处理的品质因数。根据文档(https://fatfreeframework.com/image#dump),转储方法可能采用整数值来指定质量:
$img->dump($fileType, 75) // $filetype is 'jpeg'
但我收到以下错误:
imagejpeg(): Invalid 2nd parameter, it must [sic] a filename or a stream
[...base.php:2032] Base->error(500,'imagejpeg(): Invalid 2nd parameter, it must a filename or a stream')
[...index.php:712] Image->dump('jpeg', 75)
将质量因子作为字符串而不是 int 传递可以消除消息,但生成的图像随后为空。 (我知道 jpeg 和 png 转储使用不同的 quality/compression 率值。)
知道我的错误在哪里吗?谢谢,
文档和库之间存在矛盾。该库需要一个额外的 NULL
参数,与本机 imagejpeg() 函数完全一样。
这个已经是fixed now in the framework, so you can download the edge版本的框架了,还是等下一个版本吧。
总结:
F3 <= 3.5.1
$img->dump($fileType, NULL, 75)
F3 > 3.5.1
$img->dump($fileType, 75)