PHP 手冊
前一頁 |  | 下一頁

# XXXII. Exif Functions

# 介紹

With the exif extension you are able to work with image meta data. For example, you may use exif functions to read meta data of pictures taken from digital cameras by working with information stored in the headers of the JPEG and TIFF images.

# 需求

Your PHP must be compiled in with --enable-exif. PHP does not require any additional library for the exif module. Windows users must also have the mbstring extension enabled.

# 安裝

To enable exif-support configure PHP with --enable-exif

Windows users must enable both the `php_mbstring.dll` and `php_exif.dll` DLL's in `php.ini`. The `php_mbstring.dll` DLL must be loaded before the `php_exif.dll` DLL so adjust your `php.ini` accordingly.

# 執行時期組態

`php.ini`中的設定會影響這些函數的行為。

Exif supports automatically conversion for Unicode and JIS character encodings of user comments when module mbstring is available. This is done by first decoding the comment using the specified characterset. The result is then encoded with another characterset which should match your HTTP output.

表格 1. Exif configuration options

Name | Default | Changeable
--- | --- | ---
exif.encode_unicode | "ISO-8859-15" | PHP_INI_ALL
exif.decode_unicode_motorola | "UCS-2BE" | PHP_INI_ALL
exif.decode_unicode_intel | "UCS-2LE" | PHP_INI_ALL
exif.encode_jis | "" | PHP_INI_ALL
exif.decode_jis_motorola | "JIS" | PHP_INI_ALL
exif.decode_jis_intel | "JIS" | PHP_INI_ALL

For further details and definitions of the PHP_INI_* constants, see the 附錄 H.

這裡為簡短的結構指令說明。

exif.encode_unicode string

  exif.encode_unicode defines the characterset UNICODE user comments are handled. This defaults to ISO-8859-15 which should work for most non Asian countries. The setting can be empty or must be an encoding supported by mbstring. If it is empty the current internal encoding of mbstring is used.

exif.decode_unicode_motorola string

  exif.decode_unicode_motorola defines the image internal characterset for Unicode encoded user comments if image is in motorola byte order (big-endian). This setting cannot be empty but you can specify a list of encodings supported by mbstring. The default is UCS-2BE.

exif.decode_unicode_intel string

  exif.decode_unicode_intel defines the image internal characterset for Unicode encoded user comments if image is in intel byte order (little-endian). This setting cannot be empty but you can specify a list of encodings supported by mbstring. The default is UCS-2LE.

exif.encode_jis string

  exif.encode_jis defines the characterset JIS user comments are handled. This defaults to an empty value which forces the functions to use the current internal encoding of mbstring.

exif.decode_jis_motorola string

  exif.decode_jis_motorola defines the image internal characterset for JIS encoded user comments if image is in motorola byte order (big-endian). This setting cannot be empty but you can specify a list of encodings supported by mbstring. The default is JIS.

exif.decode_jis_intel string

  exif.decode_jis_intel defines the image internal characterset for JIS encoded user comments if image is in intel byte order (little-endian). This setting cannot be empty but you can specify a list of encodings supported by mbstring. The default is JIS.

# 資源類型

這個延伸沒有定義任何資源。

# 預先定義常數

以下的常數由此延伸定義，只在這個延伸被編譯成PHP或實行時期被動態載入時有效。

`EXIF_USE_MBSTRING` (integer)

The exif_imagetype() lists several related built-in constants.

前一頁 | 內容 | 下一頁
system | 上一層 | exif_imagetype