There is no license information available for the latest version (1.0.0) of this package.

Provides the ability to extend images in SilverStripe

Installs: 5 638

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 28

Forks: 2

Open Issues: 0


1.0.0 2013-07-14 02:15 UTC

This package is auto-updated.

Last update: 2020-07-29 05:09:50 UTC


Provides the ability to extend images in SilverStripe

The problem

Providing custom image formatting was in the past thought to be easy. We would just extend Image and add our generateX functions there. We found over time however that this caused some major issues for clients, issues where images associated with certain pages, both added through Content and also associated via has_X would suddenly disappear. The underlying reason for this was a change of ClassName in the database record when the same image would be used somewhere else in the CMS (for example usage in TinyMce).

Our next option was to create a DataObjectDecorator or DataExtension and add the generateX methods there, but this had a annoyance of its own.

To achieve this you had to do something like the following:

class CustomImage extends DataExtension
    public function MyCustomFormat()
        return $this->owner->getFormattedImage('MyCustomFormat');

    public function generateMyCustomFormat(Image_Backend $backend)
        return $backend->fittedResize(80, 110);

Notice the need to define MyCustomFormat as well as generateMyCustomFormat. This gets kinda ugly when you have many formatting functions. Not nice.

The solution

To avoid this, you can now use heyday/silverstripe-imageextension. Which will allow you to simply define the generateX methods in your extension.

Installation (with composer)

$ composer require heyday/silverstripe-imageextension


class CustomImageExtension extends \Heyday\SilverStripe\ImageExtension
    public function generateTwoColumn(Image_Backend $backend)
        return $backend;


        - CustomImageExtension


SilverStripe Image Extension is licensed under an MIT license