PHP code example of wernerdweight / image-manager-bundle
1. Go to this page and download the library: Download wernerdweight/image-manager-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/ */
wernerdweight / image-manager-bundle example snippets
// config/bundles.php
return [
// ...
WernerDweight\ImageManagerBundle\WDImageManagerBundle::class => ['all' => true],
];
// this example expects you to pass image manager via DI into $imageManager
// upload your image file(s), create database records etc.
...
// process image (one by one)
// 1st parameter ($file) is instance of Symfony\Component\HttpFoundation\File\UploadedFile (mandatory)
// 2nd parameter is the filename of newly created file (mandatory)
// 3rd parameter is a path under upload_path from config (optional)
$processedImageInfo = $imageManager->processImage($file, 'destination-filename', '/optional/subpath');