PHPackages                             wendrowycz/skoch-filter-file-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. wendrowycz/skoch-filter-file-resize

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

wendrowycz/skoch-filter-file-resize
===================================

Resize utility for the Zend Framework

v1.0.2(8y ago)033MITPHPPHP &gt;=5.3.0

Since Sep 6Pushed 8y ago1 watchersCompare

[ Source](https://github.com/wendrowycz/skoch-filter-file-resize)[ Packagist](https://packagist.org/packages/wendrowycz/skoch-filter-file-resize)[ RSS](/packages/wendrowycz-skoch-filter-file-resize/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (5)Used By (0)

Skoch\_Filter\_File\_Resize
===========================

[](#skoch_filter_file_resize)

Resize utility for the Zend Framework
-------------------------------------

[](#resize-utility-for-the-zend-framework)

`Skoch_Filter_File_Resize` is a utility for integrating image resizing into the Zend Framework's `Zend_Form` structure. It is implemented as a filter which you can attach to `Zend_Form_Element_File` instances.

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

[](#installation)

- Download the folder library/Skoch from github and add it to your library files
- Add `autoloaderNamespaces[] = "Skoch_"` to your `application.ini`

Examples
--------

[](#examples)

The folders `application` and `public` contain examples for some basic usage. The most interesting file is `application/forms/Image.php`. You will need to have Zend-Framework installed to run the example.

Basic Usage
-----------

[](#basic-usage)

You can add the filter to your `Zend_Form_Element_File` instance.

```
$photo->addFilter(new Skoch_Filter_File_Resize(array(
    'width' => 200,
    'height' => 300,
    'keepRatio' => true,
)));
```

This will scale the image to a maximum of 200px length and a maximum of 300px height. One of both sides will probably be a bit smaller, because we set **keepRatio** to `true` meaning that the aspect ratio (e.g. 3:4) shall be maintained. There also is a implicit defition of **keepSmaller** set to `true` meaning that if the image is already smaller, it shall not be enlarged (because that would lead to a lot of strange pixels).

Multiple thumbnails
-------------------

[](#multiple-thumbnails)

Often you want to create several thumbnails in different sizes. This can be done by using a so called **filter chain** and the **directory** option of the `Skoch_Filter_File_Resize`.

If you specify **directory**, the value of `setDestination()` will not be considered anymore. Thus, you have to pass the full path to the **directory** option.

```
$filterChain = new Zend_Filter();
// Create one big image with at most 600x300 pixel
$filterChain->appendFilter(new Skoch_Filter_File_Resize(array(
    'width' => 600,
    'height' => 300,
    'keepRatio' => true,
)));
// Create a medium image with at most 500x200 pixels
$filterChain->appendFilter(new Skoch_Filter_File_Resize(array(
    'directory' => '/var/www/skoch/upload/medium',
    'width' => 500,
    'height' => 200,
    'keepRatio' => true,
)));
// Rename the file, of course this should not be a fixed string in real applications
$multiResize->addFilter('Rename', 'users_upload');
// Add the filter chain with both resize rules
$multiResize->addFilter($filterChain);
```

This will create two thumbnails, one of maximum 600px length and 300px height and the other of 500px length and 200px height. In each case, the aspect ratio will be kept. The smaller thumbnail will be saved to the folder `/var/www/skoch/upload/medium` while the larger one will use the default option set via Zend's `setDestination()` method.

Options / Arguments
-------------------

[](#options--arguments)

You may specify different options for the Resize Filter:

- width: The maximum width of the resized image
- height: The maximum height of the resized image
- keepRatio: Keep the aspect ratio and do not resize to both width and height (usually expected).
- keepSmaller: Do not resize if the image is already smaller than the given sizes.
- cropToFit: If the image dimensions do not match the given image, crop off some borders
- directory: Set a directory to store the thumbnail in. If nothing is given, the normal image will be overwritten.
- adapter: The adapter to use for resizing. You may specify a string or an instance of an adapter.

Further information
-------------------

[](#further-information)

You can find further information [in the article on my blog](http://eliteinformatiker.de/2011/09/02/thumbnails-upload-and-resize-images-with-zend_form_element_file/).

License
-------

[](#license)

This software is licensed under the Simplified BSD License.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

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

Every ~0 days

Total

3

Last Release

3171d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1ad5caa5978a9c88ee71faf698a2f2e015b010fe998229d5ea9ae58c658c53a6?d=identicon)[wendrowycz](/maintainers/wendrowycz)

---

Top Contributors

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

---

Tags

imagezendresizeformzend-formZF1zend form image resize

### Embed Badge

![Health badge](/badges/wendrowycz-skoch-filter-file-resize/health.svg)

```
[![Health](https://phpackages.com/badges/wendrowycz-skoch-filter-file-resize/health.svg)](https://phpackages.com/packages/wendrowycz-skoch-filter-file-resize)
```

###  Alternatives

[intervention/image

PHP Image Processing

14.3k194.3M2.2k](/packages/intervention-image)[gumlet/php-image-resize

PHP class to re-size and scale images

1.2k5.7M54](/packages/gumlet-php-image-resize)[masterexploder/phpthumb

A library for manipulating images in PHP.

981751.7k17](/packages/masterexploder-phpthumb)[sybio/image-workshop

Powerful PHP class using GD library to work easily with images including layer notion (like Photoshop or GIMP)

860918.1k11](/packages/sybio-image-workshop)[intervention/image-laravel

Laravel Integration of Intervention Image

1496.5M102](/packages/intervention-image-laravel)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)

PHPackages © 2026

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