XXXIII. 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 的影響。

mbstring 模組可用時,exif 支援會員注解中的 Unicode 和 JIS 字元編碼的自動轉換。這是通過先用指定字集將注解解碼,把結果再用另一個符合你的 HTTP 輸出的字集編碼來實現的。

表格 1. Exif configuration options

名稱預設值可修改範圍更新記錄
exif.encode_unicode"ISO-8859-15"PHP_INI_ALL自 PHP 4.3.0 起可用。
exif.decode_unicode_motorola"UCS-2BE"PHP_INI_ALL自 PHP 4.3.0 起可用。
exif.decode_unicode_intel"UCS-2LE"PHP_INI_ALL自 PHP 4.3.0 起可用。
exif.encode_jis""PHP_INI_ALL自 PHP 4.3.0 起可用。
exif.decode_jis_motorola"JIS"PHP_INI_ALL自 PHP 4.3.0 起可用。
exif.decode_jis_intel"JIS"PHP_INI_ALL自 PHP 4.3.0 起可用。
有關 PHP_INI_* 常量進一步的細節與定義參見附錄 G

以下是配置選項的簡要解釋。

exif.encode_unicode string

exif.encode_unicode 定義了 UNICODE 會員注解被處理的字集。預設為 ISO-8859-15,可用於大多數非亞洲國家。本設定可以為空或是必須為一個 mbstring 所支援的編碼。若果為空,則使用現用的 mbstring 內定使用的編碼。

exif.decode_unicode_motorola string

exif.decode_unicode_motorola 定義了 Unicode 編碼的會員注解的圖像內定字集,若果圖像是摩托羅拉位元組順序(big-endian)的話。本設定不能為空但可以指定一個 mbstring 支援的編碼清單。預設為 UCS-2BE。

exif.decode_unicode_intel string

exif.decode_unicode_intel 定義了 Unicode 編碼的會員注解的圖像內定字集,若果圖像是英特爾位元組順序(little-endian)的話。本設定不能為空但可以指定一個 mbstring 支援的編碼清單。預設為 UCS-2LE。

exif.encode_jis string

exif.encode_jis 定義了 JIS 會員注解被處理的字集。預設為空值,迫使函數使用現用的 mbstring 使用的內定編碼。

exif.decode_jis_motorola string

exif.decode_jis_motorola 定義了 JIS 編碼的會員注解的圖像內定字集,若果圖像是摩托羅拉位元組順序(big-endian)的話。本設定不能為空但可以指定一個 mbstring 支援的編碼清單。預設為 JIS。

exif.decode_jis_intel string

exif.decode_jis_intel 定義了 JIS 編碼的會員注解的圖像內定字集,若果圖像是英特爾位元組順序(litle-endian)的話。本設定不能為空但可以指定一個 mbstring 支援的編碼清單。預設為 JIS。

資源類型

本增加模組未定義任何資源類型。

預定義常量

以下常量由本增加模組定義,因此只有在本增加模組被編譯到 PHP 中,或是在運行時被動態加載後才有效。

EXIF_USE_MBSTRING (integer)

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

目錄
exif_imagetype -- 判斷一個圖像的類型
exif_read_data --  從 JPEGTIFF 檔案中讀取 EXIF 頭訊息
exif_tagname -- Get the header name for an index
exif_thumbnail -- 取得內嵌在 TIFF 或 JPEG 圖像中的縮略圖
read_exif_data -- exif_read_data() 的別名