mesavolt / imaging-bundle
Symfony bundle to facilitate image manipulation in PHP
Installs: 67
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 2
Type:symfony-bundle
Requires
- php: >=7.1
- ext-exif: *
- ext-fileinfo: *
- ext-gd: *
- rosell-dk/webp-convert: ^2.3
- symfony/config: ^3.3||^4.1
- symfony/dependency-injection: ^3.3||^4.1
- symfony/http-kernel: ^3.3||^4.1
Requires (Dev)
- php-coveralls/php-coveralls: ^2.1
- phpunit/phpunit: ^7.2
This package is auto-updated.
Last update: 2024-11-10 06:59:14 UTC
README
Installation
Use composer
:
composer require mesavolt/imaging-bundle
Applications that don't use Symfony Flex
If you don't use Symfony Flex, you need to enable the bundle by hand.
To to so, add it to the list of registered bundles in the app/AppKernel.php
file of your project:
<?php // app/AppKernel.php // ... class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Mesavolt\ImagingBundle\ImagingBundle(), ); // ... } // ... }
Configuration
The following options are available to customize the behavior of the bundle's imaging service :
Usage
Inject the Mesavolt\ImagingBundle\ImagingService
service into your services and controllers
(or get the mesavolt.imaging
service from the container) :
<?php 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 ]); } }