2011-03-21 79 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;