austral / entity-file-bundle
File uploads, thumbnails and download for entity to Symfony. Compress file with squoosh-cli
Package info
github.com/austral-project/entity-file-bundle
Type:symfony-bundle
pkg:composer/austral/entity-file-bundle
Requires
- php: ^8.0 || ^8.1 || ^8.2
- austral/entity-bundle: ^3.1
- austral/tools-bundle: ^3.1
- imagine/imagine: ^1.3
- symfony/config: ^5.4 || ^6.4
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
File uploads, thumbnails and download for entity to Symfony. Compress file with squoosh-cli
This bundle is part of Austral, a modular back office and CMS for Symfony.
Requirements
- PHP 8.4 or higher
- Symfony 7.4
Installation
composer require austral/entity-file-bundle
If you do not use Symfony Flex, register the bundle in config/bundles.php:
return [ // ... Austral\EntityFileBundle\AustralEntityFileBundle::class => ['all' => true], ];
Configuration
# config/packages/austral_entity_file.yaml austral_entity_file: compression: command: '' # command that compresses the uploaded images; none when not set options: webp: { quality: 70 } cropper: # merged with the default croppers: desktop, tablet, mobile desktop: { name: desktop, picto: austral-picto-monitor, ratio: '16/9' } image_size: # merged with the default sizes (default: 100 to 10000 pixels) default: width: { min: 100, max: 10000 } height: { min: 100, max: 10000 } uploads: # merged with the default rules: default_image, default_file (2M) default_image: size: { max: '5M' } mimeTypes: [ 'image/jpeg', 'image/png', 'image/webp' ]
The configuration of the application is merged with the default values, then with the values declared by the
bundles (the avatar of security-bundle, for example): a list (mimeTypes, croppers) replaces the list it
overrides, and a value that is not set keeps the default one.
# config/routes/austral_entity_file.yaml: thumbnails and downloads austral_entity_file: resource: '@AustralEntityFileBundle/Resources/config/routes.yaml'
With the Austral recipes, Flex creates both files.
Usage
Administration
When austral/admin-bundle 4 is installed, the configuration page of the admin
(/austral-admin/status-configuration) shows the category "Uploads": the rules default_image and default_file, then each
file field of the entities, with its maximum size, accepted MIME types, size of the images and upload folder. A rule without
maximum size or that accepts every MIME type is a warning: set size.max and mimeTypes in austral_entity_file.uploads.
Documentation
The full documentation is available at https://austral.dev.
Versions
| Bundle | Symfony | PHP | Branch |
|---|---|---|---|
| 4.x | 7.4 | ≥ 8.4 | 4.x |
| 3.1 | 5.4 / 6.4 | ≥ 8.0 | 3.1 (maintenance) |
See the CHANGELOG and, to upgrade from 3.1, UPGRADE-4.0.
Contributing
Contributions are welcome: see the contributing guide. To report a security issue, follow the security policy.
License
MIT, see LICENSE.
Credits
Created by Matthieu Beurel. Sponsored by Yipikai Studio.