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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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   1199 Views

Avatar
MarioSommereder

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
MarioSommereder

Community Member, 107 Posts

29 April 2013 at 7:18pm

Mark?