图像元数据操作类

属性
命名空间 fize\image
类名 Exif
方法:
方法名 说明
__construct() 构造
imagetype() 获取当前图像的类型
readData() 从 JPEG 或 TIFF 文件中读取 EXIF 头信息
tagname() 获取指定索引的头名称
thumbnail() 取得嵌入在 TIFF 或 JPEG 图像中的缩略图

方法

__construct()

构造

public function __construct (
    string $filename
)
参数:
名称 说明
filename 完整含目录文件名

imagetype()

获取当前图像的类型

public function imagetype () : int
返回值:返回值和 getimagesize() 返回的数组中的索引 2 的值是一样的,但本函数快得多

readData()

从 JPEG 或 TIFF 文件中读取 EXIF 头信息

public function readData (
    string $sections = null,
    bool $arrays = false,
    bool $thumbnail = false
) : array
参数:
名称 说明
sections FILE|COMPUTED|ANY_TAG|IFD0|THUMBNAIL|COMMENT|EXIF
arrays 指定了是否每个区段都成为一个数组
thumbnail 是否读取缩略图本身。否则只读取标记数据。
返回值:

如果没有可供返回的数据将返回 FALSE

tagname()

获取指定索引的头名称

public static function tagname (
    int $index
) : string
参数:
名称 说明
index 要查找的标签名称的 ID。
返回值:

返回头名称。 如果 index 参数不是预定义的 EXIF 标签 id,则返回 FALSE

thumbnail()

取得嵌入在 TIFF 或 JPEG 图像中的缩略图

public function thumbnail (
    int &$width = null,
    int &$height = null,
    int &$imagetype = null
) : string
参数:
名称 说明
width 本字段将返回缩略图的宽
height 本字段将返回缩略图的高
imagetype 本字段将返回缩略图的图像的类型
返回值:

缩略图字节流,可用于直接输出