Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

How to resize an image directly after the upload?


Go to End


3 Posts   853 Views

Avatar
MarioHofer

Community Member, 107 Posts

14 March 2013 at 3:52am

Hi,

I try to limit the size of uploaded image to a maximum of 1600 px, but I don't get it... :-(

That's what I have so far:

class WebImage extends Image {
    protected function onBeforeWrite() {
        parent::onBeforeWrite();
        $this->SetRatioSize(1600, 1600);
    }
}

Thanks for any help.

Best, Mario

Avatar
2dealsok

Community Member, 1 Post

29 April 2013 at 6:18pm

Mark

Avatar
MarioHofer

Community Member, 107 Posts

29 April 2013 at 7:18pm

Mark?