6
votes

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

3
Give it a try and let me know Sonata Media CropM Khalid Junaid

3 Answers

2
votes

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

0
votes

I wrote a simple admin extension that give you the ability to customize the images by format. It's actually a Work In Progress that needs some test, documentation and refactoring, but it does the job, it's lightweight and it's shipped with a resizer to handle fixed dimensions.

You can find it here: https://github.com/julien-maitan/sonata-media-crop

-1
votes

If you are using sonata media bundle with sonata admin, there is a picasa photo editor already in place in media edit form.

Please check.