Search code examples
imagesymfonyuploadresizeliipimaginebundle

how to resize the original image after upload with LiipImagineBundle on symfony3?


I saw this link and it's close that i want. Use LiipImagineBundle to Resize Image after Upload?

I use symfony 3 with the bundle LiipImagineBundle. I just want to resize the ORIGINAL image in the class controller just after uploaded it. I don't want to create a thumbnail on the cache folder.

Let's see the sample below: If a user upload a file 1800*1200 i want to resize it to 800*600 on the file system and I don't want to keep the file 1800*1200.

Is it possible with LiipImagineBundle ?

Thank you.


Solution

  • you can do this by implementing a special filter (crop) just like this

    # LiipImagineBundle
    liip_imagine:
        resolvers:
            default:
                web_path:
                    web_root: ~
                    cache_prefix: media/cache
        filter_sets:
            image_xlarge:
                filters:
                    crop: { size: [800, 600], mode: outbound }
    

    referrer http://symfony.com/doc/current/bundles/LiipImagineBundle/filters/sizing.html#cropping-images