Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony2 Sonata Media Bundle Custom Image Cropping

It seems that Sonata Media has only two strategies when it comes to cropping/resizing the uploaded image, Sonata\MediaBundle\Resizer\SimpleResizer and Sonata\MediaBundle\Resizer\SquareResizer. Both these strategies are automatic, meaning that the users don't have a say in how they want the image to be resized/croppped.

I would like to give the user an option to select the portion of the image that is more relevant, kind like the jQuery Image Cropper library used by GenemuFormBundle, but I don't even know where to start. Will I need to create my own Admin class instead of using Sonata\MediaBundle\Admin\BaseMediaAdmin? Has anyone write a bundle that I can use? How do you manage your galleries usually?

enter image description here

like image 987
Aman Varshney Avatar asked Dec 04 '13 16:12

Aman Varshney


Video Answer


1 Answers

You should look at ComurImageBundle. It's far easier than Sonata Media, doesn't create anything in database and lets you upload with jquery file uploader, crop with jcrop and other useful things.

enter image description here

like image 124
Can Avatar answered Oct 09 '22 11:10

Can