fynduck / files-upload
A description for filesUpload.
Installs: 771
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 0
Type:package
Requires
- php: >=7.0
- illuminate/support: ^5.0|^6.0|^7.0|^8.0|^9.0|^10.0
- spatie/image-optimizer: ^1.2.0|^1.3.0
- dev-master
- 3.1.6
- 3.1.5
- 3.1.4
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.82
- 3.0.81
- 3.0.8
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1
- 2.0.7.1
- 2.0.7
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2.1
- 2.0.2
- 2.0.1
- 2.0
- 1.9
- 1.8.6.2
- 1.8.6.1
- 1.8.6
- 1.8.5
- 1.8.4
- 1.8.3
- 1.8.2
- 1.8.1
- 1.8
- 1.7.6
- 1.7.5
- 1.7.4
- 1.7.3
- 1.7.2.1
- 1.7.2
- 1.7.1
- 1.7
- 1.6
- 1.5
- 1.4
- 1.3
- 1.2
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1
- 1.0
- dev-update1.8
This package is auto-updated.
Last update: 2024-11-05 08:17:09 UTC
README
Usage
Upload file or image
use Fynduck\FilesUpload\UploadFile; UploadFile::file($request->file('file')) //or $request->get('base64'), required ->setDisk('storage') //default is public ->setFolder('Post') //optional ->setName('image_name') //optional, default use file name or random in case base64 ->setOverwrite('old_name.jpg') //optional, remove file with old name ->setSizes(['xs' => ['width' => 100, 'height' => 100]]) //(optional) if need other sizes ->setExtension('png') //(optional) default use file extension ->setBackground('#000000') //optional ->setBlur(0) //optional, use values between 0 and 100 ->setBrightness(0) //optional, use values between -100 and +100. brightness 0 for no change ->setGreyscale(true) //optional true or false default is true ->setOptimize() //optional ->setEncodeFormat() //optional, ['jpeg', 'jpg', 'png', 'gif', 'webp'] ->setEncodeQuality() //optional, use values between 0 and 100 ->save('resize'); //save option resize, resize-crop, crop default is resize
Make new sizes from image
use Fynduck\FilesUpload\ManipulationImage; ManipulationImage::load($pathImage) ->setDisk('storage') //default is public ->setFolder('Post') ->setSizes(['xs' => ['width' => 100, 'height' => 100]]) ->setName('image_name.jpg') //name with extension ->setOverwrite('old_name.jpg') //optional, remove file with old name ->setBackground('#000000') //optional ->setBlur(0) //optional, use values between 0 and 100 ->setBrightness(0) //optional, use values between -100 and +100. brightness 0 for no change ->setGreyscale(true) //optional true or false default is true ->setOptimize() //optional ->setEncodeFormat() //optional, ['jpeg', 'jpg', 'png', 'gif', 'webp'] ->setEncodeQuality() //optional, use values between 0 and 100 ->save('resize'); //save option resize, resize-crop, crop default is resize
Optimize exist image
use Fynduck\FilesUpload\ManipulationImage; ManipulationImage::load('') ->setOptimize() ->optimize($pathImage);
resize: Resize the image by the minimum width or height resize-crop: Resize the image by the minimum width or height of the side and crop to the center
crop: Cut out by size part of the current image with given width and height
For laravel < 5.7 use version 1.8
Use for previous versions
Install
composer require fynduck/files-upload
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.