sonata-project / SonataMediaBundle

Symfony SonataMediaBundle
https://docs.sonata-project.org/projects/SonataMediaBundle
MIT License
451 stars 495 forks source link

No support for gif format? #237

Closed tworzenieweb closed 11 years ago

tworzenieweb commented 11 years ago

Hi,

today i was trying to made some gallery of advertisements for my page. I have installed this bundle as always with Symfony 2.1. I was a little surprised that image validator didn't allow me to send any gif files. Only jpeg files pass. Is there any special config parameter that controls this?

I have checked provider.xml file for any hints but

 <service id="sonata.media.provider.image" class="%sonata.media.provider.image.class%">
            <tag name="sonata.media.provider" />
            <argument>sonata.media.provider.image</argument>
            <argument />
            <argument />
            <argument />
            <argument type="service" id="sonata.media.thumbnail.format" />
            <argument />
            <argument />
            <argument />

            <call method="setTemplates">
                <argument type="collection">
                    <argument key='helper_thumbnail'>SonataMediaBundle:Provider:thumbnail.html.twig</argument>
                    <argument key='helper_view'>SonataMediaBundle:Provider:view_image.html.twig</argument>
                </argument>
            </call>
        </service>

This definition is rather straightforward with image provider constructor

public function __construct($name, Filesystem $filesystem, CDNInterface $cdn, GeneratorInterface $pathGenerator, ThumbnailInterface $thumbnail, array $allowedExtensions = array(), array $allowedMimeTypes = array(), ImagineInterface $adapter)

so my question is based on which parameter set of allowed extensions and mime types is fetched?

tworzenieweb commented 11 years ago

ok i found allowed_extensions and similar for mime. Problem solved.

rande commented 11 years ago

gif image can't be resized

tworzenieweb commented 11 years ago

I don't need to resize it, just upload into specific gallery. Why gif cannot be resized? it's limitation of this bundle ?

rande commented 11 years ago

From memory, animated gif cannot be resized with GD or image magick

tworzenieweb commented 11 years ago

That is also what I remember but not all gif's are animated so there shouldn't be any problem with them right?

ornj commented 11 years ago

@tworzenieweb, can you provide an example of how you were able to use allowed_extensions in your config?

tworzenieweb commented 11 years ago

Sure, it was something like this:

sonata_media:
    providers:
        image:
          allowed_extensions: ['jpg', 'png', 'gif', 'jpeg']
          allowed_mime_types: ['image/pjpeg','image/jpeg','image/png','image/x-png', 'image/gif']
ornj commented 11 years ago

So obvious now that I see it. Thanks for posting that!

dvapelnik commented 9 years ago

I know that this is old thread but anyway Can I except all gif-files from re-sizing? For instance, using specific provider with dummy re-sizer only for gif-files Any examples? Thanks

r-sede commented 3 years ago

I know that this is old thread but anyway Can I except all gif-files from re-sizing? For instance, using specific provider with dummy re-sizer only for gif-files Any examples? Thanks

still have an issue, anybody ?

jordisala1991 commented 3 years ago

This issue was created almost 10 years ago. Please open a new issue with your concrete issue, make sure you fill the whole issue template.