Simple file uploader for documents and images with resize opportunity
evmusonov/laravel-file-helper is a Laravel package for simple file uploader for documents and images with resize opportunity.
It currently has 0 GitHub stars and 14 downloads on Packagist (latest version v1.0.2).
Install it with composer require evmusonov/laravel-file-helper.
Discover more Laravel packages by evmusonov
or browse all Laravel packages to compare alternatives.
Last updated
Simple file uploader for documents and images with resize opportunity
composer require evmusonov/laravel-file-helper
Evmusonov\LaravelFileHelper\FileHelperServiceProvider::class
php artisan vendor:publish
php artisan migrate
Package contains two types of files: images (jpg, png, ...) and documents (pdf, docx, ...). So you can configure mimes for yourself in documentExtensions and imageExtensions settings.
By default, config contains pathToStorage, it means you may write your own path for storage, but default path is recommended for usage.
If you want to set own versions for resizing, you can put it in versions setting, follow the example in the config file.
$uploadManager = new FileManager();
$imageUploader = $uploadManager->createImageUploder('put your file input name');
$imageUploader->upload('path/to/[module]/[id]');
Path for future file must contain module directory and item's id in the end of the sentence.
You may write $imageUploader->upload('user/1'); or $imageUploader->upload('somefolder/anotherfolder/user/1');
(optional) 4. If you want to resize your image
$imageUploader->upload('user/1')->resize('your version');
$imageUploader->upload('user/1')->resize('200x200');