2011-03-21 37 views
3

根据PHP的官方文档中imagepng()函数具有以下特征:标准值()函数

bool imagepng (resource $image [, string $filename [, int $quality [, int $filters ]]]) 

我现在需要知道的是什么$质量的标准值是。我无法在文档中的任何地方找到它。

有没有解释它的人或知道它的人?

回答

9
从PHP源(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. 
*/ 

结论: 基于Zlib手册(http://www.zlib.net/manual.html)默认的压缩级别设置为6.

+0

非常感谢! – tyrondis 2011-03-21 14:32:53

1

从:http://us2.php.net/manual/en/function.imagepng.php

压缩级别:0(无 压缩)到9

默认值为0

+0

那不是我的问题。我想知道PHP的价值,如果我没有指定一个非常简单的 – tyrondis 2011-03-21 13:58:04

+0

:查看源代码,或保存图像11次,没有值和每个0-9值。无论哪一个匹配的“无价值”保存是你的默认值。 – 2011-03-21 14:09:52

0

在PHP的源代码质量参数默认为0.但我没有想法该值对于图像处理是最佳的。

 
static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)()) 
{ 
    zval *imgind; 
    char *file = NULL; 
    long quality = 0, type = 0;