bitandblack/image-information

读取图像信息

2.0.1 2023-11-13 12:47 UTC

This package is auto-updated.

Last update: 2024-09-13 14:43:47 UTC


README

PHP from Packagist Latest Stable Version Total Downloads License

Bit&Black 图像信息

读取图像信息

  • 大小
  • 色彩配置文件

目前支持的文件和扩展名

  • ai Adobe Illustrator Artwork
  • bmp Windows Bitmap
  • eps Encapsulated PostScript
  • gif Graphics Interchange Format
  • ico 初始币发行
  • iff 交换文件格式
  • jp2, jpf (扩展) JPEG 2000
  • jpg, jpeg 联合图像专家组
  • pdf 可移植文档格式
  • png 可移植网络图形
  • psd (Adobe) Photoshop 文档
  • svg 可缩放矢量图形
  • tif, tiff 标记图像文件格式
  • wbmp 无线应用协议位图格式
  • webp Google WebP

安装

此包是为与 Composer 一起使用而制作的。通过运行 $ composer require bitandblack/image-information 将其添加到您的项目中。

使用方法

使用 File 类定义您的文件。然后初始化 Image 类并添加您的文件

<?php

use BitAndBlack\ImageInformation\Image;
use BitAndBlack\ImageInformation\Source\File;

$file = new File('MyFile.eps');
$image = new Image($file);

访问图像大小:$image->getSize();

访问图像的色彩配置文件:$image->getICCProfile();

缓存

您可以通过使用缓存来加快库的运行速度。在初始化图像类时,将缓存对象作为第二个参数添加

<?php

use BitAndBlack\ImageInformation\Cache\Cache;
use BitAndBlack\ImageInformation\Image;
use BitAndBlack\ImageInformation\Source\File;

$file = new File('MyFile.eps');
$image = new Image($file, new Cache());

默认情况下,缓存类使用文件系统缓存。这可以通过仅使用 PSR 兼容的缓存类进行配置。

帮助

如果您有任何问题,请随时通过 hello@bitandblack.com 联系我们。

有关 Bit&Black 的更多信息,请访问 www.bitandblack.com