PHPackages                             loumray/fastimagesize - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. loumray/fastimagesize

ActiveLibrary[Image &amp; Media](/categories/media)

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.

v2.0.2(8y ago)216.8k↓45%1MITPHPPHP &gt;=5.3.0

Since Apr 7Pushed 8y ago1 watchersCompare

[ Source](https://github.com/loumray/fastimagesize)[ Packagist](https://packagist.org/packages/loumray/fastimagesize)[ Docs](https://github.com/loumray/fastimagesize)[ RSS](/packages/loumray-fastimagesize/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (13)Used By (0)

A faster getimagesize
=====================

[](#a-faster-getimagesize)

[![Build Status](https://camo.githubusercontent.com/2916be07eda0e4a7533fa524c91465d661f046d2b3ae5056fe20ff0d3bd2601f/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6c6f756d7261792f66617374696d61676573697a652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/loumray/fastimagesize)[![Code Coverage](https://camo.githubusercontent.com/12f6216bcca8dceb8f1611f88a47f8215c0166dd0a83d166abb69459aa467d08/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6c6f756d7261792f66617374696d61676573697a652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/loumray/fastimagesize/?branch=master)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Packagist Version](https://camo.githubusercontent.com/2ece9c5bdbb4252b27c750a70c06d021323dda764c94800612c815900fc2e0fe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6f756d7261792f66617374696d61676573697a652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/loumray/fastimagesize)[![Quality Score](https://camo.githubusercontent.com/987ff374436eeabc4e49137e6b1fe37139e6117fb1c079bf7c2890f4a13b0f3e/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6c6f756d7261792f66617374696d61676573697a652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/loumray/fastimagesize)

This package provides a getimagesize function that aims to match the usage of [PHP getimagesize](http://php.net/manual/en/function.getimagesize.php) 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

[](#requirements)

PHP 5.3.0 or greater.

### Installation

[](#installation)

```
  composer require loumray/fastimagesize

```

### Usage

[](#usage)

```
array \FastImageSize\getimagesize(String filepath);

```

Return array as per [PHP getimagesize function](http://php.net/manual/en/function.getimagesize.php)

Index 0 and 1 contains respectively the width and the height of the image.

Index 2 is one of the [IMAGETYPE\_XXX](http://php.net/manual/en/image.constants.php) 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

[](#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,
);

```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 61.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~89 days

Recently: every ~54 days

Total

11

Last Release

3164d ago

Major Versions

v1.1.3 → v2.0.02017-09-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/94e3bd838a8eef96e8b8dc92487809e136a6c9ee8393f488e02fcdb88b5aa655?d=identicon)[loumray](/maintainers/loumray)

---

Top Contributors

[![marc1706](https://avatars.githubusercontent.com/u/394418?v=4)](https://github.com/marc1706 "marc1706 (66 commits)")[![loumray](https://avatars.githubusercontent.com/u/4295644?v=4)](https://github.com/loumray "loumray (40 commits)")[![danielhanold](https://avatars.githubusercontent.com/u/580920?v=4)](https://github.com/danielhanold "danielhanold (1 commits)")[![pierreuh](https://avatars.githubusercontent.com/u/6187845?v=4)](https://github.com/pierreuh "pierreuh (1 commits)")

---

Tags

getimagesizephpimagefastsizegetimagesizeimagesize

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/loumray-fastimagesize/health.svg)

```
[![Health](https://phpackages.com/badges/loumray-fastimagesize/health.svg)](https://phpackages.com/packages/loumray-fastimagesize)
```

###  Alternatives

[marc1706/fast-image-size

fast-image-size is a PHP library that does almost everything PHP's getimagesize() does but without the large overhead of downloading the complete file.

959.4M21](/packages/marc1706-fast-image-size)[dantsu/php-image-editor

PHP library to easily edit image with GD extension.

34152.1k2](/packages/dantsu-php-image-editor)[lciolecki/php-image-optimizer

PHP image file optimizer (uses https://github.com/bensquire/php-image-optim)

347.4k](/packages/lciolecki-php-image-optimizer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
