bencagri / photon-bundle
1.0.0
2018-02-09 13:48 UTC
Requires
- bencagri/photon: ^1.0
This package is auto-updated.
Last update: 2024-10-29 00:01:37 UTC
README
Photon is an image acceleration and modification service for Jetpack-connected WordPress sites.
To use in symfony, PhotonBundle uses Photon Wrapper
compatibility Symfony 3.x, 4.x
Installation
composer require bencagri/photon-bundle
Then register the bundle in app/AppKernel.php
<?php use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; class AppKernel extends Kernel { public function registerBundles() { $bundles = [ .... //Photon Bundle new \Bencagri\PhotonBundle\PhotonBundle(), ];
Thats it.
Usage
There is a service that you can use in Symfony.
in your controller
;
use Photon\Wrapper\Effect\Filter; use Photon\Wrapper\Effect\Width; use Photon\Wrapper\Effects; ... public function indexAction(Request $request) { //get the service $generator = $this->get('bencagri.photon.service'); //register the effects that you want to use $effects = new Effects( new Width(700), new Filter('emboss') ); $imageUrl = 'https://images.com/my.jpg'; //generate the picture $generator->setImageUrl($imageUrl); $generator->setEffects($effects); $generator->generate(); }
See all effects that you can use on Photon Wrapper examples.
Licence
- The Photon Bundle is open-sourced software licensed under the MIT license.
- The Photon Wrapper is open-sourced software licensed under the MIT license.
- The Photon is open-sourced software licenced under GNU GENERaL PUBLIC LICENCE