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


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  —  3 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  —  3 years ago

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

Some example for others:


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

Custom class:


namespace App\Providers;

use Anomaly\FilesModule\File\FileUploader;

class Abc extends FileUploader

ryanthompson  —  3 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.