Sonata MediaBundle .tif support

123 Views Asked by At

I'm trying to configure Sonata MediaBundle to upload various images formats but it's not working for .tif and .tiff image formats. After the upload it throws the following error:

request.CRITICAL: Uncaught PHP Exception Imagine\Exception\RuntimeException: "An image could not be created from the given input" at /var/www/releases/current/vendor/imagine/imagine/lib/Imagine/Gd/Imagine.php line 190 {"exception":"[object] (Imagine\\Exception\\RuntimeException(code: 0): An image could not be created from the given input at /var/www/releases/current/vendor/imagine/imagine/lib/Imagine/Gd/Imagine.php:190)"} []

The app is running on Symfony 3.3 with php 7.1 in Linux AWS, other image formats like jpg are working fine

My sonata_media part of config.yml is:

sonata_media:
    db_driver: doctrine_orm
    default_context: archivio
    contexts:
        default:  # the default context is mandatory
            download:
                strategy: sonata.media.security.public_strategy
            providers:
                - sonata.media.provider.image

            formats:
                small: { width: 100 , quality: 100}
                big:   { width: 500 , quality: 100}
        archivio:
            download:
                strategy: sonata.media.security.public_strategy
            providers:
                - sonata.media.provider.image

            formats:
                small: { width: 100 , quality: 100}
                big:   { width: 500 , quality: 100}
    cdn:
        server:
            path: 'https://s3-%s3_region%.amazonaws.com/%s3_bucket_name%'

    providers:
        image:
            filesystem: sonata.media.filesystem.s3
            allowed_extensions: ['jpg', 'png', 'jpeg', 'tif', 'tiff']
            resizer: sonata.media.resizer.square
            generator:  sonata.media.generator.default
            allowed_mime_types: ['image/pjpeg', 'image/jpeg', 'image/png', 'image/x-png', 'image/tiff']
    filesystem:
        s3:
            sdk_version: 3
            bucket:      '%s3_bucket_name%'
            accessKey:   '%s3_access_key%'
            secretKey:   '%s3_secret_key%'
            region:      '%s3_region%'
            version:     '%s3_version%'
0

There are 0 best solutions below