[files-module] I need to change image size on upload.
Created 6 years ago by vargvinter

Hello,

How can I hook my implementation to resize images without messing in core? I found that I can put my code into FileUploader file but as I wrote I don't want to mess in core.

ryanthompson  —  6 years ago Best Answer

Try binding your own FileUploader class to the core one. Otherwise I can write a hook cause I don't think one technically exists right now.

vargvinter  —  6 years ago

Thanks. Binding works. Now I have to implement my logic.

Some example for others:

config/streams.php

    'singletons' => [
        \Anomaly\FilesModule\File\FileUploader::class => \App\Providers\Abc::class
    ],

Custom class:

<?php

namespace App\Providers;

use Anomaly\FilesModule\File\FileUploader;

class Abc extends FileUploader
{

}
ryanthompson  —  6 years ago

@vargvinter perfect - soon this will be baked into the module. Supporting different types of logic on upload. But this is a great way to do it for the time being.