I'm new to Silverstripe and am having trouble finding the answer to my issue in the documentation or on SO.
I'm using Silverstripe purely as a CMS: there is no website as a frontend.
I have the simplest DataObject Product
and a ModelAdmin ProductAdmin
as follows:
class Product extends DataObject
{
private static $db = array(
'Name' => 'Varchar',
'Copy' => 'Text'
);
private static $has_one = array(
'MyImage' => 'Image'
);
}
class ProductAdmin extends ModelAdmin
{
private static $managed_models = array(
'Product'
);
private static $url_segment = 'product';
private static $menu_title = 'Product';
}
After a /dev/build
, my admin panel is built and I can upload a high resolution image to the 'Uploads' directory as usual.
I would like on upload for the CMS to resample the image into several different sizes, whilst also retaining the original. The new and original images also need to be saved to a location where the FlushGeneratedImagesTask will not delete them. From looking through the documentation, I know that images can be resized easily, but it's not clear to me where (or how) to add the custom functionality required. Can anyone help?
(I think Silverstripe 3.1 - resize image on upload comes closest to answering this, but there is a step missing that shows how to get the CMS to use the new/overridden functionality.)
I am using Silverstripe version 3.1