PHPackages                             toughdeveloper/imageresizer - 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. toughdeveloper/imageresizer

ActiveOctober-plugin

toughdeveloper/imageresizer
===========================

October CMS Plugin to resize and compress images.

v1.4.0(6y ago)462.1k↓50%39[10 issues](https://github.com/toughdeveloper/oc-imageresizer-plugin/issues)[3 PRs](https://github.com/toughdeveloper/oc-imageresizer-plugin/pulls)MITPHP

Since Jan 15Pushed 2y ago7 watchersCompare

[ Source](https://github.com/toughdeveloper/oc-imageresizer-plugin)[ Packagist](https://packagist.org/packages/toughdeveloper/imageresizer)[ RSS](/packages/toughdeveloper-imageresizer/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelogDependencies (2)Versions (6)Used By (0)

Image Resizer
=============

[](#image-resizer)

- [Introduction](#introduction)
- [Available filters](#filters)
- [Using a string](#string)
- [Using a variable](#variable)
- [resize()](#resize)
- [imageWidth() - imageHeight()](#imageDimensions)
- [Image Compression](#compression)

Introduction
------------

[](#introduction)

Resizes an image to the required dimensions. It accepts a string with a file path to the image or a `October\Rain\Database\Attach\File` object (you will have one of these if you have used the attachOne or AttachMany relationship)

Please note, the not found image can be overwritten via the settings in the admin area.

Available filters
-----------------

[](#available-filters)

[`resize(int $width [, int $height , array $options])`](#resize), [`imageWidth()`](#imageDimensions), [`imageHeight()`](#imageDimensions)

### Using a string

[](#using-a-string)

Please note, if the filter alters the URL, you must apply resize afterwards

```
{{ 'assets/graphics/background.jpg' | theme | resize(500,500) }}

```

### Using a variable

[](#using-a-variable)

```
{{ property.image | resize(500) }}

```

resize(int $width \[, int $height , array $options\])
-----------------------------------------------------

[](#resizeint-width--int-height--array-options)

Resize an image according to the given params. If `$width` or `$height` is `0`, that value is calculated using original image ratio

### Options

[](#options)

KeyDescriptionDefaultOptionsmodeHow the image should be fitted to dimensionsautoexact, portrait, landscape, auto, fit or cropoffsetOffset the resized image\[0,0\]\[int, int\]extensionThe extension on the image to returnautoauto, jpg, jpeg, gif, pngqualityThe quality of compression *\*requires cache clear*950-100sharpenSharpen the image across a scale of 0 - 100 *\*requires cache clear*00-100compressWhether the image should be compressed or not. Only takes effect when TinyPng compression is enabled.truetrue,false### Usage in template

[](#usage-in-template)

```
{{ property.image | resize(500, false, { mode: 'crop', quality: '80', extension: 'png' }) }}

```

### Usage in PHP

[](#usage-in-php)

The image resizer can also be used easily in PHP, as follows:

```
use ToughDeveloper\ImageResizer\Classes\Image;

$image = new Image('/path/to/image.jpg');
$image->resize(150, 200, [ 'mode' => 'crop' ]);

```

### Usage in Backend List

[](#usage-in-backend-list)

The image resizer can also be used on backend lists with the type of `thumb`, e.g.

```
image:
    label: Image
    type: thumb

```

This works with:

- AttachMany (uses first image) [Docs](https://octobercms.com/docs/backend/forms#widget-fileupload)
- AttachOne [Docs](https://octobercms.com/docs/backend/forms#widget-fileupload)
- Mediafinder [Docs](https://octobercms.com/docs/backend/forms#widget-mediafinder)

You can also optionally pass width (default 50), height (default 50) and options as follows:

```
image:
    label: Image
    type: thumb
    width: 75
    height: 100
    options:
        mode: crop

```

imageWidth() - imageHeight()
----------------------------

[](#imagewidth---imageheight)

Return current image width/height - useful if you need to know the size of an image resized only by one side.

```
{{ '/path/to/image.jpg' | resize(250) | imageHeight() }}

```

Image Compression via TinyPNG
-----------------------------

[](#image-compression-via-tinypng)

The plugin integrates with the TinyPNG API to provide image compression. A developer API key is required, to obtain one visit . Once obtained, enter it in the Image Resizer Settings area of October CMS backend.

TinyPNG offer 500 free compression per month, the plugin automatically caches resized images to save credits, an option to not compress certain images is also available.

If you are focussed on pagespeed, it is recommended to set your image quality at 70-80 to obtain the lowest filesize whilst still retaining high quality images.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community26

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

2423d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/58c5707b3e81b6a26434bd8267afdede829541a9da8747779bf5617c31b315c9?d=identicon)[DieterHolvoet](/maintainers/DieterHolvoet)

---

Top Contributors

[![matt-pawley](https://avatars.githubusercontent.com/u/17622801?v=4)](https://github.com/matt-pawley "matt-pawley (30 commits)")[![matteotrubini](https://avatars.githubusercontent.com/u/7964032?v=4)](https://github.com/matteotrubini "matteotrubini (17 commits)")[![mattpawley](https://avatars.githubusercontent.com/u/4113253?v=4)](https://github.com/mattpawley "mattpawley (14 commits)")[![gergo85](https://avatars.githubusercontent.com/u/2959112?v=4)](https://github.com/gergo85 "gergo85 (12 commits)")[![LukeTowers](https://avatars.githubusercontent.com/u/7253840?v=4)](https://github.com/LukeTowers "LukeTowers (3 commits)")[![chocolata](https://avatars.githubusercontent.com/u/3584586?v=4)](https://github.com/chocolata "chocolata (3 commits)")[![everyx](https://avatars.githubusercontent.com/u/1665522?v=4)](https://github.com/everyx "everyx (2 commits)")[![mauserrifle](https://avatars.githubusercontent.com/u/1580250?v=4)](https://github.com/mauserrifle "mauserrifle (2 commits)")[![DieterHolvoet](https://avatars.githubusercontent.com/u/3606531?v=4)](https://github.com/DieterHolvoet "DieterHolvoet (2 commits)")[![FelixINX](https://avatars.githubusercontent.com/u/8009156?v=4)](https://github.com/FelixINX "FelixINX (2 commits)")[![yapsr](https://avatars.githubusercontent.com/u/3018553?v=4)](https://github.com/yapsr "yapsr (1 commits)")[![cx-emerge](https://avatars.githubusercontent.com/u/3308685?v=4)](https://github.com/cx-emerge "cx-emerge (1 commits)")[![linkapiotr](https://avatars.githubusercontent.com/u/35471762?v=4)](https://github.com/linkapiotr "linkapiotr (1 commits)")[![lthurston](https://avatars.githubusercontent.com/u/202726?v=4)](https://github.com/lthurston "lthurston (1 commits)")[![multiwebinc](https://avatars.githubusercontent.com/u/901732?v=4)](https://github.com/multiwebinc "multiwebinc (1 commits)")[![alxy](https://avatars.githubusercontent.com/u/2057062?v=4)](https://github.com/alxy "alxy (1 commits)")

---

Tags

image-compressionimage-resizeroctober-cmsphp

### Embed Badge

![Health badge](/badges/toughdeveloper-imageresizer/health.svg)

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

###  Alternatives

[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k15.7k5](/packages/elgg-elgg)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

44643.1k1](/packages/pressbooks-pressbooks)[johnbillion/user-switching

Instant switching between user accounts in WordPress and WooCommerce.

19768.3k2](/packages/johnbillion-user-switching)[rainlab/blog-plugin

Blog plugin for October CMS

17257.7k](/packages/rainlab-blog-plugin)[rainlab/user-plugin

User plugin for October CMS

11954.3k13](/packages/rainlab-user-plugin)

PHPackages © 2026

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