1. Go to this page and download the library: Download ldiro/media-bundle 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/ */
ldiro / media-bundle example snippets
use Artgris\Bundle\MediaBundle\Form\Validator\Constraint as MediaAssert; // optionnal, to force image files
// ...
/**
* @var string
* @ORM\Column(type="string")
* @Assert\NotNull()
*/
private $image;
/**
* @var Collection|string[]
* @ORM\Column(type="simple_array", nullable=true)
* @MediaAssert\Image()
*/
private $gallery;
'crop_options' => [
'display_crop_data' => true, // will display crop box informations (x, y, width, height, and ratio if there is one)
'allow_flip' => true, // allows to flip the image vertically and horizontally
'allow_rotation' => true, // allows to rotate the image (90 degrees)
'ratio' => false // force a crop ratio. E.g 16/9
],