PHPackages                             polycast/polycast-filter-imagesize - 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. polycast/polycast-filter-imagesize

AbandonedArchivedLibrary

polycast/polycast-filter-imagesize
==================================

Zend\_Filter implementation for resizing images using different strategies.

201.9k4[1 issues](https://github.com/polycaster/Zend_Filter_ImageSize/issues)[1 PRs](https://github.com/polycaster/Zend_Filter_ImageSize/pulls)PHP

Since Nov 11Pushed 13y ago1 watchersCompare

[ Source](https://github.com/polycaster/Zend_Filter_ImageSize)[ Packagist](https://packagist.org/packages/polycast/polycast-filter-imagesize)[ RSS](/packages/polycast-polycast-filter-imagesize/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

`Polycast_Filter_ImageSize`
===========================

[](#polycast_filter_imagesize)

> Zend Framework extension providing filter facilities for image size using different strategies.

Minimal example
---------------

[](#minimal-example)

```

```

Complex example
---------------

[](#complex-example)

- Crop the image instead of fit it into the bounding box.
- Output as JPEG (actually this is the same as above as it is the default)
- Set a specific output directory `(default = ./)`
- Use caching, i.e. override only if source image is newer than thumbnail (if exists)

\[markdown syntax is stupid\]

```

```

Humongous example
-----------------

[](#humongous-example)

```
class NamedConfig extends Polycast_Filter_ImageSize_Configuration_Standard
{
    protected $_templateName = null;

    public function __construct($templateName)
    {
        $this->_templateName = $templateName;
    }

    public function getTemplateName()
    {
        return $this->_templateName;
    }
}

class CustomPathBuilder implements Polycast_Filter_ImageSize_PathBuilder_Interface
{
    private $_outputDir = null;

    public function __construct($outputDir)
    {
        $this->_outputDir = $outputDir;
    }

    public function buildPath($filename, Polycast_Filter_ImageSize_Configuration_Interface $config)
    {
        $chunks = explode('.', strrev(basename($filename)), 2);
        $basename = strrev(array_pop($chunks));
        $ext = strrev(array_pop($chunks));

        switch($config->getOutputImageType()) {

            case 'jpeg': $ext = '.jpg'; break;
            case 'gif': $ext = '.gif'; break;
            case 'png': $ext = '.png'; break;

            case 'auto':
            case null:
            default:
                $ext = ".$ext";
        }

        if ($config instanceof NamedConfig) {
            $postfix = $config->getTemplateName();
        } else {
            $postfix = sprintf('%sx%s-q%s', $config->getWidth(), $config->getHeight(), $config->getQuality());
        }

        $path = sprintf('%s/%s-%s%s',
            $this->_outputDir,
            $basename,
            $postfix,
            $ext
        );

        return $path;
    }
}

$filter = new Polycast_Filter_ImageSize();
$config = $filter->getConfig();

$config = new NamedConfig('product-thumbnail-100x100');
$config
       ->setWidth(100)
       ->setHeight(100)
       ->setQuality(50)
       ->setStrategy(new Polycast_Filter_ImageSize_Strategy_Crop())
       ->setOverwriteMode(Polycast_Filter_ImageSize::OVERWRITE_ALL)
;

$filter->setConfig($config);
$filter->setOutputPathBuilder(new CustomPathBuilder('images/thumbnails/'));
$outputPath = $filter->filter('./rick.jpg');

```

More examples
-------------

[](#more-examples)

Have a look at the `tests/ExamplesTest.php` which demonstrates how to implement own path builders and configurations.

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

[](#installation)

### composer

[](#composer)

If you want to use this library in your project, adjust your `composer.json`like this:

```
"require": {
    "polycast/polycast-filter-imagesize": "master-dev"
},

```

If you want to work on this library use the following command, which will checkout the project from github and install all dependencies needed for development.

`composer create-project --dev polycast/polycast-filter-imagesize polycast-filter-imagesize`

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity43

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/facd7b39173f2c9d7225d8cdba2f5fc94a5f965f84145fea70a57130001b3f77?d=identicon)[polycaster](/maintainers/polycaster)

---

Top Contributors

[![AndreasBaumgart](https://avatars.githubusercontent.com/u/65380?v=4)](https://github.com/AndreasBaumgart "AndreasBaumgart (40 commits)")

### Embed Badge

![Health badge](/badges/polycast-polycast-filter-imagesize/health.svg)

```
[![Health](https://phpackages.com/badges/polycast-polycast-filter-imagesize/health.svg)](https://phpackages.com/packages/polycast-polycast-filter-imagesize)
```

PHPackages © 2026

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