1. Go to this page and download the library: Download insitaction/easycrop library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
public function configureCrud(): Crud
{
return parent::configureCrud()
->addFormTheme('@EasyCrop/form_theme.html.twig')
;
}
use Insitaction\EasyCropBundle\Field\CropField;
// ...
yield CropField::new('image', 'Image')
->setBasePath('/uploads/images/')
->setUploadDir('public/uploads/images/')
->setFormat('WEBP') // choices are 'PNG', 'JPEG', 'WEBP'.
->enableSizeValidation(true) // enable min size validation
->enableResize(true) // enable resize
->setHeight(600) // Set the desired height for resizing or validation
->setWidth(800) // Set the desired width for resizing or validation
;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.