-
-
Notifications
You must be signed in to change notification settings - Fork 494
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 CropResizer #1940
Add CropResizer #1940
Conversation
e3e8e8e
to
dafb5d2
Compare
Can you add some docs on how to use this new feature? |
Done |
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.
We can merge this PR. My comments are only suggestion how we can improve it.
@@ -1,6 +1,7 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> | |||
<parameters> | |||
<parameter key="sonata.media.resizer.crop.class">Sonata\MediaBundle\Resizer\CropResizer</parameter> |
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.
IMO Will be nice to remove these parameters from xml
and move it to the bundle configurator.
new Reference('sonata.media.metadata.proxy'), | ||
]); | ||
$definition->addTag('sonata.media.resizer'); | ||
$container->setDefinition('sonata.media.resizer.crop', $definition); |
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.
Can we create sonata.media.resizer.base_crop
for default class and sonata.media.resizer.crop
alias for service or class configured by users?
Subject
Adds a new resizer that is similar to the existing
SquareResizer
, but the result can have any image ratio.The new resizer can crop the Image to a given ratio. When given an Image with 1200 x 700 and you want an image with the format 100 x 70, the resizer will first scale the image down to 120 x 70 and then crops the remaining parts down to 100 x 70.
I am targeting this branch, because this feature is BC.
Changelog