Invalid mime type : image/gif

1,146 views
Skip to first unread message

Sergejs Smirnovs

unread,
Jan 29, 2013, 8:25:16 AM1/29/13
to sonata...@googlegroups.com
Trying to upload gif image as Media in Media Bundle, but receving "Invalid mime type : image/gif" in production, and no message on dev. server :(

Sergejs Smirnovs

unread,
Feb 1, 2013, 6:59:05 AM2/1/13
to sonata...@googlegroups.com
Solution:

    providers:
        image:
            resizer: sonata.media.resizer.simple
            allowed_mime_types:
              - image/gif
              - image/jpeg
              - image/png
              - image/pjpeg
            allowed_extensions:
              - gif
              - png
              - jpeg
              - jpg

Guillaume Meyer

unread,
May 17, 2013, 5:42:27 AM5/17/13
to sonata...@googlegroups.com
Hy,

I tried to implement your solution but it does'nt work. Can you help me ? Thank's !

I have this error and i don't understand why ...
Invalid type for path "sonata_media.contexts.default.providers.image". Expected scalar, but got array.

My config file :

sonata_media:
    default_context: default
    db_driver: doctrine_orm
    contexts:
        default:
            providers:
                image:
                  resizer: sonata.media.resizer.simple
                  allowed_mime_types:
                    - image/gif
                    - image/jpeg
                    - image/png
                    - image/pjpeg
                  allowed_extensions:
                    - gif
                    - png
                    - jpeg
                    - jpg
            formats:
                small: { width: 100 , quality: 70}
                big:   { width: 500 , quality: 70} 

Guillaume Meyer

unread,
May 17, 2013, 5:53:33 AM5/17/13
to sonata...@googlegroups.com
So I just found a solution at the moment ... It's in config file. 

My new config file :

sonata_media:
    providers:
        file:
          allowed_extensions: ['mp4', 'flv']
          allowed_mime_types: ['video/mp4', 'video/x-flv']
        image:
          allowed_extensions: ['jpg', 'png', 'gif', 'jpeg']
          allowed_mime_types: ['image/pjpeg','image/jpeg','image/png','image/x-png', 'image/gif']
    default_context: default
    db_driver: doctrine_orm
    contexts:
        default:
            providers:
                - sonata.media.provider.image
                - sonata.media.provider.file
            formats:
                small: { width: 100 , quality: 70}
                big:   { width: 500 , quality: 70}

Le mardi 29 janvier 2013 14:25:16 UTC+1, Sergejs Smirnovs a écrit :
Reply all
Reply to author
Forward
0 new messages