PHPackages                             dmcblue/php-image-resize - 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. dmcblue/php-image-resize

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

dmcblue/php-image-resize
========================

Resizes images

1.0.0(7y ago)011MITPHP

Since Oct 8Pushed 7y ago1 watchersCompare

[ Source](https://github.com/dmcblue/php-image-resize)[ Packagist](https://packagist.org/packages/dmcblue/php-image-resize)[ RSS](/packages/dmcblue-php-image-resize/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

php-image-resize
================

[](#php-image-resize)

A convenience tool to resize a batch of images into different sizes for website asset responsiveness.

Requirements
------------

[](#requirements)

- PHP 7+
- PHP [GD image module](http://php.net/manual/en/image.setup.php)

Features
--------

[](#features)

- Resizes images or a folder of images into predefined size sets.
- Two types of resize: `contain` and `cover`, think [CSS background-size](https://developer.mozilla.org/en-US/docs/Web/CSS/background-size).
- Can be configured to prevent enlarging of images, with down sampling only (the default).
- Handles any number of size groups all at once.
- Adds postfixes to the filename.
- Currently handles BMP, (static) GIF, JPG and PNG.

### Notes

[](#notes)

The code is limited by the allowed memory size designated in php.ini by `memory_limit`. If php tries to allocate more memory than it is allowed, it will shutdown in the middle of creating a file.

When running the script again, it will run into this truncated file *in the output folder* and throw the following error:

```
"PHP Warning:  imagecreatefrompng(): gd-png:  fatal libpng error: Read Error: truncated data in..."

```

You just need to delete the file (or better all the output files to be sure) and then run the script again.

I have not found a satisfactory way to detect either of these problems before a shutdown error.

Usage
-----

[](#usage)

```
// Load composer libs
require("some/file/path/vendor/autoload.php");

$imageResizer = new \Dmcblue\ImageResize\ImageResizer();
$configArray =
	[
		'originalPath' => '/path/to/original/images',
		'sizeConfigs' => [[
			'outputPath' => '/path/to/resized/images/thumbnails',
			'postfix' => '_thumbnail',
			'type' => \Dmcblue\ImageResize\Type::COVER,
			'width' => 50,
			'height' => 50,
		],[
			'outputPath' => '/path/to/resized/images/large',
			'postfix' => '_lrg',
			'type' => \Dmcblue\ImageResize\Type::CONTAIN,
			'width' => 2000,
			'height' => 2000,
		]]
	];
$config = new \Dmcblue\ImageResize\Config($configArray);
$imageResizer->resizeAll($config);
// Or resize a single image
$imageResizer->resize('/path/to/original/image.jpg', $config);
// Creates
//    /path/to/resized/images/thumbnails/image_thumbnail.jpg
//    /path/to/resized/images/large/image_lrg.jpg
```

Tests
-----

[](#tests)

```
"./vendor/bin/phpunit" --bootstrap "vendor/autoload.php" tests

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2775d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5190228?v=4)[Dan Crawford](/maintainers/dmcblue)[@dmcblue](https://github.com/dmcblue)

---

Top Contributors

[![dmcblue](https://avatars.githubusercontent.com/u/5190228?v=4)](https://github.com/dmcblue "dmcblue (5 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dmcblue-php-image-resize/health.svg)

```
[![Health](https://phpackages.com/badges/dmcblue-php-image-resize/health.svg)](https://phpackages.com/packages/dmcblue-php-image-resize)
```

###  Alternatives

[milon/barcode

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

1.5k13.3M39](/packages/milon-barcode)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[goat1000/svggraph

Generates SVG graphs

132849.6k3](/packages/goat1000-svggraph)[cohensive/embed

Media Embed (for Laravel or as a standalone).

120370.4k](/packages/cohensive-embed)[netresearch/rte-ckeditor-image

Image support in CKEditor for the TYPO3 ecosystem - by Netresearch

63991.3k4](/packages/netresearch-rte-ckeditor-image)[humanmade/tachyon-plugin

Rewrites WordPress image URLs to use Tachyon

87338.5k2](/packages/humanmade-tachyon-plugin)

PHPackages © 2026

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