bitandblack / image-information
读取图像信息
2.0.1
2023-11-13 12:47 UTC
Requires
- php: >=8.0
- ext-dom: *
- bitandblack/composer-helper: ^1.0
- bitandblack/duration: ^1.0
- bitandblack/iccprofile: ^0
- bitandblack/pathinfo: ^1.0
- myclabs/php-enum: ^1.8
- psr/cache: ^3.0
Requires (Dev)
- ext-imagick: *
- phpstan/phpstan: ^1.0
- phpunit/phpunit: ^9.0
- rector/rector: ^0
- symfony/cache: ^6.0
- symplify/easy-coding-standard: ^12.0
README
Bit&Black 图像信息
读取图像信息
- 大小
- 色彩配置文件
目前支持的文件和扩展名
ai
Adobe Illustrator Artworkbmp
Windows Bitmapeps
Encapsulated PostScriptgif
Graphics Interchange Formatico
初始币发行iff
交换文件格式jp2
,jpf
(扩展) JPEG 2000jpg
,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。