PHPackages                             rtablada/resize-and-pad - 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. rtablada/resize-and-pad

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

rtablada/resize-and-pad
=======================

Imagine filter to resize and pad images to a set width and height

0250PHP

Since Feb 24Pushed 12y ago1 watchersCompare

[ Source](https://github.com/rtablada/resize-and-pad)[ Packagist](https://packagist.org/packages/rtablada/resize-and-pad)[ RSS](/packages/rtablada-resize-and-pad/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Resize And Pad
--------------

[](#resize-and-pad)

This is a simple Imagine Filter to allow you to resize and pad images with whitespace to ensure consistent sizing without cropping or stretching.

Installing
----------

[](#installing)

Add `"rtablada/resize-and-pad": "dev-master"` to your `composer.json` file.

Use
---

[](#use)

Using this filter is quite similar to the Transformation Filter in Imagine. Inject your instance of Imagine and then call `setSize`. Here we will use a GD instance, but any instance of `Imagine\Image\ImageInterface` will do.

```
$imagine = new \Imagine\GD\Imagine;
$resizer = new \Rtablada\Images\ResizeAndPad($imagine);
$image = $imagine->open($pathToImage);

$resizer->setSize(200, 200);
$output = $resizer->apply($image);
$output->save($outputPath);
```

The `setSize` and `apply` functions allow for chaining so the above could be written like this:

```
$resizer->setSize(200, 200)->apply($image)->save($outputPath);
```

Use with Stapler
----------------

[](#use-with-stapler)

This Filter was originally built for use within a Laravel project using [Stapler](https://github.com/CodeSleeve/stapler). Using this filter with Stapler is quite simple when defining your styles:

```
$this->hasAttachedFile('avatar', [
	'styles' => [
		'medium' => '300x300',
		'thumb' => function($file, $imagine) {
			$resizer = \Rtablada\Images\ResizeAndPad($imagine);
			return $resizer->setSize(100,100)->apply($file);
		}
	]
]);
```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/ea9ccd400c74151601341e320935a31d1a9779c5eb49a8f364bc7a0ac75baa32?d=identicon)[rtablada](/maintainers/rtablada)

---

Top Contributors

[![rtablada](https://avatars.githubusercontent.com/u/2532004?v=4)](https://github.com/rtablada "rtablada (3 commits)")

### Embed Badge

![Health badge](/badges/rtablada-resize-and-pad/health.svg)

```
[![Health](https://phpackages.com/badges/rtablada-resize-and-pad/health.svg)](https://phpackages.com/packages/rtablada-resize-and-pad)
```

###  Alternatives

[goat1000/svggraph

Generates SVG graphs

133890.0k3](/packages/goat1000-svggraph)[imagekit/imagekit

PHP library for Imagekit

46877.3k10](/packages/imagekit-imagekit)[gravatarphp/gravatar

Gravatar URL builder which is most commonly called as a Gravatar library

12644.1k2](/packages/gravatarphp-gravatar)

PHPackages © 2026

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