CakePHP plugin for upload files
, (*1)
Upload files with processing images using GD or ImageMagick library., (*2)
Requirements
It is developed for CakePHP 4.x., (*3)
Installation
You can install plugin into your CakePHP application using composer., (*4)
The recommended way to install composer packages is:, (*5)
composer require slicesofcake/file
Setup
Add file type input in your view:, (*6)
echo $this->Form->control('logo', [
'type' => 'file',
]);
You should also add 'type' => 'file'
in your creating form method., (*7)
Note: If you want use multiple file input (from HTML5), just replace name of input field from logo
to logo[]
and add to options attribute multiple
., (*8)
Next, load behavior in your table on initialize
method, like below:, (*9)
$this->addBehavior('SlicesCake/File.File', [
'logo',
]);
Note: Field should be accessible in Entity class., (*10)
TODOs
- [x] Add light Exceptions
- [x] Work with ImageMagick
- [ ] Work with Gmagick
- [x] Add support to WEBP image type
- [ ] Add support to own method to generate names
- [x] Add support to work with many files
- [ ] Add command to work with files
- [ ] Add support to EXIF
- [ ] Add support to correct orientation by EXIF (https://stackoverflow.com/questions/7489742/php-read-exif-data-and-adjust-orientation)