loumray/fastimagesize
最新稳定版本:v2.0.2
Composer 安装命令:
composer require loumray/fastimagesize
包简介
This package provides a getimagesize function that aims to match the usage of PHP getimagesize while trying to avoid the performance cost of downloading the complete file.
README 文档
README
This package provides a getimagesize function that aims to match the usage of PHP getimagesize while trying to avoid the performance cost of downloading the complete file.
It currently supports the following image types:
- BMP
- GIF
- ICO
- IFF
- JPEG 2000
- JPEG
- PNG
- PSD
- TIF/TIFF
- WBMP
Requirements
PHP 5.3.0 or greater.
Installation
composer require loumray/fastimagesize
Usage
array \FastImageSize\getimagesize(String filepath);
Return array as per PHP getimagesize function
Index 0 and 1 contains respectively the width and the height of the image.
Index 2 is one of the IMAGETYPE_XXX constants indicating the type of the image.
Index 3 is a text string with the correct height="yyy" width="xxx" string that can be used directly in an IMG tag.
mime is the correspondant MIME type of the image.
It will however not return channels and bits index that getimagesize sometimes returns.
Just like for PHP getimagesize, you can pass any local or remote image to this library as long as it's readable.
Backward Compatibility
For backward compatibility, the FastImageSize class is still available. So you can still make use of
$FastImageSize = new \FastImageSize\FastImageSize();
$imageSize = $FastImageSize->getImageSize(String filepath);
And this will return the array size
array(
'width' => 16,
'height' => 16,
'type' => IMAGETYPE_PNG,
);
统计信息
- 总下载量: 14.94k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-09-13