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

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

martijnvdb/php-image-resize
===========================

Simple library for resizing and converting images to different filetypes

0.1.0(4y ago)069MITPHP

Since May 22Pushed 4y ago1 watchersCompare

[ Source](https://github.com/martijnvdb87/php-image-resize)[ Packagist](https://packagist.org/packages/martijnvdb/php-image-resize)[ Docs](https://github.com/martijnvdb87/php-image-resize)[ RSS](/packages/martijnvdb-php-image-resize/feed)WikiDiscussions main Synced 6d ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

PHP Image Resize
================

[](#php-image-resize)

This simple library allows you to resize and convert images to a different filetype. The supported filetypes are JPG, PNG, GIF and WebP. Animated GIF and WebP files are not supported.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require martijnvdb/php-image-resize
```

Usage
-----

[](#usage)

Add the composer autoloader to your application and create a new instance of the ImageResize class given the path to the source images as the first argument.

```
require __DIR__ . '/vendor/autoload.php';

use Martijnvdb\ImageResize\ImageResize;

$image = new ImageResize(__DIR__ . '/image-1.jpg');
```

### Methods

[](#methods)

Use the `export()` method to save the image to the given path. By default it will convert the source image to the given output filetype. In the following example it will convert the original JPG image to a WebP image.

```
$image = new ImageResize(__DIR__ . '/image-1.jpg');
$image->export(__DIR__ . '/resized/image-1.webp');
```

Using the `setWidth()` and `setHeight()` methods, you can set the maximum size the width and height of the exported image. By default it won't change the aspect ratio of the image. Therefore the image will be scaled up or down to fit within the given size constraints. You can use both the `setWidth()` and `setHeight()` methods when exporting an image, or just a single one.

```
$image = new ImageResize(__DIR__ . '/image-1.jpg');
$image->setWidth(500);
$image->setHeight(500);
$image->export(__DIR__ . '/resized/image-1.webp');
```

You can use the `ignoreRatio()` to ignore the aspect ratio of the source image and strech the exported image to the given width and height.

```
$image = new ImageResize(__DIR__ . '/image-1.jpg');
$image->setWidth(500);
$image->setHeight(500);
$image->ignoreRatio();
$image->export(__DIR__ . '/resized/image-1.webp');
```

The `setQuality()` method is used to change the quality of the exported image. It accepts a float between `0` and `1`, with `0` being the worst and `1` being the best quality. The default is `0.9` and can only be used when exporting to JPG, PNG and WebP filetypes.

```
$image = new ImageResize(__DIR__ . '/image-1.jpg');
$image->setQuality(0.65);
$image->export(__DIR__ . '/resized/image-1.webp');
```

It is also possible to use the static `get()` method for easier method chaining.

```
$image = ImageResize::get(__DIR__ . '/image-1.jpg')
    ->setWidth(500)
    ->setHeight(500)
    ->setQuality(.8)
    ->ignoreRatio()
    ->export(__DIR__ . '/resized/image-1.webp');
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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

1820d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16452270?v=4)[martijnvdb](/maintainers/martijnvdb)[@MartijnvdB](https://github.com/MartijnvdB)

---

Top Contributors

[![martijnvdb87](https://avatars.githubusercontent.com/u/41451264?v=4)](https://github.com/martijnvdb87 "martijnvdb87 (7 commits)")

---

Tags

imageimage-resizerphpresizeimage resize

### Embed Badge

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

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

###  Alternatives

[ctessier/nova-advanced-image-field

An advanced image field for Nova with cropping and resizing.

103548.4k1](/packages/ctessier-nova-advanced-image-field)[goat1000/svggraph

Generates SVG graphs

132849.6k3](/packages/goat1000-svggraph)[francodacosta/phmagick

image manipulation with php and ImageMagick

3869.7k1](/packages/francodacosta-phmagick)[contao/image

Contao image library

131.7M9](/packages/contao-image)[intervention/image-driver-vips

libvips driver for Intervention Image

4495.5k6](/packages/intervention-image-driver-vips)[ayvazyan10/nova-imagic

Imagic is a Laravel Nova field package that allows for image manipulation capabilities, such as cropping, resizing, quality adjustment, and WebP conversion. It utilizes the powerful Intervention Image class for image manipulation.

144.3k1](/packages/ayvazyan10-nova-imagic)

PHPackages © 2026

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