PHP code example of mesavolt / imaging-bundle
1. Go to this page and download the library: Download mesavolt/imaging-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/ */
mesavolt / imaging-bundle example snippets
// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new Mesavolt\ImagingBundle\ImagingBundle(),
);
// ...
}
// ...
}
namespace App;
use Mesavolt\ImagingBundle\Service\ImagingService;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class HomeController extends AbstractController
{
public function index(ImagingService $imagingService)
{
$relative = '/public/thumbnails/thumbnail.jpeg';
$path = $this->getParameter('kernel.project_dir').$relative;
$imagingService->shrink('/tmp/image.jpg', $path);
return $this->render('home/index.html.twig', [
'shrunk' => $relative
]);
}
}