承接 loumray/fastimagesize 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

Build Status Code Coverage Software License Packagist Version Quality Score

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 21
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-09-13