-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support to Imagine Basic filters #59
Conversation
if (!isset($options['options'])) { | ||
throw new InvalidArgumentException(sprintf( | ||
'Options for filter type "%s" must be specified', $filter | ||
)); | ||
} | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should remove old code instead of commenting it. Versionning is handled by git, not by comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right, I forgot them. fixed
This is a great idea, thanks for the work. The way you changed filter manager won't allow for extension with custom filter loaders as it will always use the basic filter loader. The idea was to make it easy for users to write loaders for their own filters. I would prefer you left filter manager as is but split the code into individual filter loaders for each filter or registered basic filter loader in DIC for each filter it can load using appropriate tag. |
Yes I considered making one individual filter loaders, but then I saw the amount of code was not big, and also it's intuitive for me that all basic filters would stay in some BasicFilter.php class. |
I think we should treat all filters the same and configure them using dependency injection container and tags. By hard-coding a special case for basic filters we're not doing mixing configuration with code and not taking advantage of DIC. You should be able to just tag basic filter loader with: <tag name="imagine.filter.loader" filter="thumbnail" />
<tag name="imagine.filter.loader" filter="crop" />
<tag name="imagine.filter.loader" filter="resize" />
<tag name="imagine.filter.loader" filter="rotate" />
<tag name="imagine.filter.loader" filter="flipHorizontally" />
<tag name="imagine.filter.loader" filter="flipVertically" /> and leave FilterManager untouched @stof, is this correct? |
@avalanche123 yes, except that your compiler pass only reads the first tag and ignore others currently. But it can be fixed easily |
@inmarelibero I merged @stof's pull request, so now you should be able to register one filter loader to load multiple filters like I showed in my comment above. Please update your pull request so I can merge it |
this has been stale for a while, are you still interested in landing this in bundle? |
closing for the lack of activity |
This PR aims to give support to almost all the Imagine basic filters, not only
thumbnail
.The list of the new filters supported is:
As described in the documentation, these are the basic filters that could be interesting for image manipulation in twig. Filters like
copy
orpaste
are not implemented.A user would be now able to use all these options in
config.yml
: