超越PHP PHP动态 | 经典文章 | CLASS | 相关下载 | 常见问题 | FORUM | WIKI | 在线手册
Site search:    
<Imagegetimagesize>
Last updated: Fri, 22 Jun 2007

gd_info

(PHP 4 >= 4.3.0, PHP 5)

gd_info -- 取得当前安装的 GD 库的信息

说明

array gd_info ( void )

返回一个关联数组描述了安装的 GD 库的版本和性能。

表格 1. gd_info() 返回的数组的单元

属性含义
GD Versionstring 值描述了安装的 libgd 的版本。
Freetype Supportboolean 值。如果安装了 Freetype 支持则为 TRUE
Freetype Linkage string 值描述了 Freetype 连接的方法。取值可能为:'with freetype', 'with TTF library' 和 'with unknown library'。本单元仅在 Freetype Support 的值为 TRUE 时有定义。
T1Lib Supportboolean 值。如果包含有 T1Lib 支持则为 TRUE
GIF Read Support boolean 值。如果包含有读取 GIF 图像的支持则为 TRUE
GIF Create Support boolean 值。如果包含有创建 GIF 图像的支持则为 TRUE
JPG Supportboolean 值。如果包含有 JPG 支持则为 TRUE
PNG Supportboolean 值。如果包含有 PNG 支持则为 TRUE
WBMP Supportboolean 值。如果包含有 WBMP 支持则为 TRUE
XBM Supportboolean 值。如果包含有 XBM 支持则为 TRUE

例子 1. 使用 gd_info()

<?php
var_dump
(gd_info());
?>

典型输出为:

array(9) {
  ["GD Version"]=>
  string(24) "bundled (2.0 compatible)"
  ["FreeType Support"]=>
  bool(false)
  ["T1Lib Support"]=>
  bool(false)
  ["GIF Read Support"]=>
  bool(true)
  ["GIF Create Support"]=>
  bool(false)
  ["JPG Support"]=>
  bool(false)
  ["PNG Support"]=>
  bool(true)
  ["WBMP Support"]=>
  bool(true)
  ["XBM Support"]=>
  bool(false)
}

参见 imagepng()imagejpeg()imagegif()imagewbmp()imagetypes()




add a note add a note User Contributed Notes
gd_info
johnschaefer at gmx dot de
10-Apr-2003 08:25
this is a replacement for this function.
you can also use this function in php >= 4.3.

the handling is the same as the gd_info function (array gd_info(void))

<?php
$code = 'function gd_info() {
     $array = Array(
                      "GD Version" => "",
                      "FreeType Support" => 0,
                      "FreeType Support" => 0,
                      "FreeType Linkage" => "",
                      "T1Lib Support" => 0,
                      "GIF Read Support" => 0,
                    "GIF Create Support" => 0,
                    "JPG Support" => 0,
                      "PNG Support" => 0,
                      "WBMP Support" => 0,
                      "XBM Support" => 0
                   );
       $gif_support = 0;

      ob_start();
       eval("phpinfo();");
       $info = ob_get_contents();
       ob_end_clean();
     
      foreach(explode("\n", $info) as $line) {
          if(strpos($line, "GD Version")!==false)
              $array["GD Version"] = trim(str_replace("GD Version", "", strip_tags($line)));
           if(strpos($line, "FreeType Support")!==false)
              $array["FreeType Support"] = trim(str_replace("FreeType Support", "", strip_tags($line)));
          if(strpos($line, "FreeType Linkage")!==false)
              $array["FreeType Linkage"] = trim(str_replace("FreeType Linkage", "", strip_tags($line)));
          if(strpos($line, "T1Lib Support")!==false)
              $array["T1Lib Support"] = trim(str_replace("T1Lib Support", "", strip_tags($line)));
          if(strpos($line, "GIF Read Support")!==false)
              $array["GIF Read Support"] = trim(str_replace("GIF Read Support", "", strip_tags($line)));
          if(strpos($line, "GIF Create Support")!==false)
              $array["GIF Create Support"] = trim(str_replace("GIF Create Support", "", strip_tags($line)));
          if(strpos($line, "GIF Support")!==false)
              $gif_support = trim(str_replace("GIF Support", "", strip_tags($line)));
           if(strpos($line, "JPG Support")!==false)
               $array["JPG Support"] = trim(str_replace("JPG Support", "", strip_tags($line)));

<Imagegetimagesize>
 Last updated: Fri, 22 Jun 2007
view source | feedback | send page | sitemap | aboutus   
Copyright ® 2002-2003 PHPE.NET. All rights reserved
Last updated:2002-11-22