Comments (5)
You can use your own controller. It is possible to set it in service container:
parameters:
imagine.controller.class: Company\AnyBundle\Controller\ImagineController
The controller can look like this:
<?php
namespace Company\AnyBundle\Controller;
use Avalanche\Bundle\ImagineBundle\Imagine\CachePathResolver;
use Avalanche\Bundle\ImagineBundle\Imagine\Filter\FilterManager;
use Imagine\ImagineInterface;
use Symfony\Component\HttpKernel\Util\Filesystem;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Finder\Finder;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class ImagineController extends \Avalanche\Bundle\ImagineBundle\Controller\ImagineController
{
/**
* @var Symfony\Component\HttpFoundation\Request
*/
private $request;
/**
* @var Avalanche\Bundle\ImagineBundle\Imagine\CachePathResolver
*/
private $cachePathResolver;
/**
* @var Imagine\ImagineInterface
*/
private $imagine;
/**
* @var Avalanche\Bundle\ImagineBundle\Imagine\FilterManager
*/
private $filterManager;
/**
* @var Symfony\Component\HttpKernel\Util\Filesystem
*/
private $filesystem;
/**
* @var string
*/
private $webRoot;
/**
* Constructs by setting $cachePathResolver
*
* @param Symfony\Component\HttpFoundation\Request $request
* @param Avalanche\Bundle\ImagineBundle\Imagine\CachePathResolver $cachePathResolver
* @param Imagine\ImagineInterface $imagine
* @param Avalanche\Bundle\ImagineBundle\Imagine\FilterManager $filterManager
* @param string $webRoot
*/
public function __construct(
Request $request,
CachePathResolver $cachePathResolver,
ImagineInterface $imagine,
FilterManager $filterManager,
Filesystem $filesystem,
$webRoot
)
{
parent::__construct($request, $cachePathResolver, $imagine, $filterManager, $filesystem, $webRoot);
$this->request = $request;
$this->cachePathResolver = $cachePathResolver;
$this->imagine = $imagine;
$this->filterManager = $filterManager;
$this->filesystem = $filesystem;
$this->webRoot = $webRoot;
}
public function filter($path, $filter)
{
Your code...
}
}
from avalancheimaginebundle.
sure you can .. but it would be better to refactor the existing controller to be more extensible
from avalancheimaginebundle.
@avalanche123: is there an ETA for this? IIRC you said you would have a go at this, if not i will try to find time to get on this during this week.
from avalancheimaginebundle.
FYI .. i am working on a rather large refactoring that includes this feature among several others.
from avalancheimaginebundle.
closed in favor of #25
from avalancheimaginebundle.
Related Issues (20)
- Using Chain and/or Paste Filters HOT 3
- Not working HOT 3
- Routing is not working for Symfony version 2.5
- Serving images on alternate URI
- RouteNotFoundException instead of NotFoundHttpException
- ImageMagick fails to open a JPG
- How to use filters other than 'my_thumb'? HOT 2
- Thumbnail of SVG files
- Incorrect permissions on cached images HOT 3
- 'source_root' in each filter does not override the global 'source_root' HOT 2
- CROP FILTER
- imagine blur symfony2
- Uncaught PHP Exception Imagine\Exception\InvalidArgumentException code 0
- Disabled Autorotate
- Mistake in clear cache in CachePathResolver
- Ephemeral storage solution
- worker queue image transformations
- How can I keep the size of an image in the cache, when I updated an image? HOT 1
- upgrade to Symfony 3
- apply_filter doesn't create image cache in symfony prod HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from avalancheimaginebundle.