Compress images when upload

Hi all! I’am using System\Models\File for storage images. How i can compress images when upload them?

“october/rain”: “v2.2.34”,
“laravel/framework”: “6.20.44”,
“october/all”: “v2.2.0”,

Thanks in advance.

Hello @Answer42

We have a plan to include automatic resizing with File models at some stage. Right now it is only possible using a plugin event.

System\Models\File::extend(function($model) {
    $model->bindEvent('afterCreate', function() {
        // Locate the file and resize it after creation
    });
});
1 Like