rezozero / intervention-request-bundle
Symfony bundle for using ambroisemaupate/intervention-request library
Installs: 12 080
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/rezozero/intervention-request-bundle
Requires
- php: >=8.2
- ambroisemaupate/intervention-request: ^7.0
- symfony/console: >=4.4.0
- symfony/framework-bundle: >=4.4.0
Requires (Dev)
README
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require rezozero/intervention-request-bundle
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the config/bundles.php file of your project:
// config/bundles.php
return [
// ...
\RZ\InterventionRequestBundle\RZInterventionRequestBundle::class => ['all' => true],
];
Add the routing:
# app/config/routing.yml
# ...
rz_intervention_request:
resource: "@RZInterventionRequestBundle/Resources/config/routing.yml"
prefix: /
Step 3: configuration
# config/packages/rz_intervention_request.yaml
parameters:
env(IR_DEFAULT_QUALITY): '90'
env(IR_MAX_PIXEL_SIZE): '1920'
ir_default_quality: '%env(int:IR_DEFAULT_QUALITY)%'
ir_max_pixel_size: '%env(int:IR_MAX_PIXEL_SIZE)%'
rz_intervention_request:
driver: 'gd'
default_quality: '%ir_default_quality%'
max_pixel_size: '%ir_max_pixel_size%'
cache_path: "%kernel.project_dir%/public/assets"
files_path: "%kernel.project_dir%/public/files"
jpegoptim_path: /usr/bin/jpegoptim
pngquant_path: /usr/bin/pngquant
subscribers: []
Then add the following variables to your project .env file:
###> rezozero/intervention-request-bundle ###
IR_DEFAULT_QUALITY=90
IR_MAX_PIXEL_SIZE=2500
###< rezozero/intervention-request-bundle ###
Use Flysystem file resolver
Declare a flysystem storage named intervention_request.storage and
this bundle will automatically use it instead of the LocalFileResolver:
# Read the documentation at https://github.com/thephpleague/flysystem-bundle/blob/master/docs/1-getting-started.md
flysystem:
storages:
intervention_request.storage:
adapter: 'local'
options:
directory: '%kernel.project_dir%/public/files'
Use a S3 storage
Requires league/flysystem-async-aws-s3 then declare your intervention_request.storage using a S3 client:
services:
s3_public_client:
class: 'AsyncAws\S3\S3Client'
arguments:
- endpoint: '%env(APP_S3_STORAGE_ENDPOINT)%'
accessKeyId: '%env(APP_S3_STORAGE_ACCESS_KEY)%'
accessKeySecret: '%env(APP_S3_STORAGE_SECRET_KEY)%'
flysystem:
storages:
intervention_request.storage:
adapter: 'asyncaws'
visibility: 'private'
options:
client: 'scaleway_public_client'
bucket: '%env(APP_S3_STORAGE_BUCKET_ID)%'
prefix: 'public-files'