pfodo
August 20, 2018, 12:34pm
1
Hi All,
I would like to show Animated GIF files in Quark blog list page.
Gif file is added to Page Media and also selected as Hero Image but not showing.
JPGs and PNGs works fine, but GIF not.
I tried to change filetype of GIF In user/config/media.yaml
from animated
to image
but the result is, there is showing just static image and not animated gif.
Any ideas or suggestions how to fix it?
fodo
Animated gifs are not seen as being of type ‘image’ but as ‘animated image’ (see Supported Media Files ).
In the blog template the ‘hero_image’ is selected from the set of ‘images’, which does not contain animated gifs… hence the ‘hero_image’ is not found.
Workaround:
In /user/themes/quark/templates/blog.html.twig
replace the line:
{% set blog_image = page.media.images[page.header.hero_image] ?: page.media.images|first %}
by:
{% set blog_image = page.media[page.header.hero_image] ?: page.media.images|first %}
Hope this helps…
I have the same problem. I also wanted to add a gif and unfortunately I have not found a wise one that would suggest why it does not work.
As @pfodo has already mentioned, one could copy /system/config/media.yaml
to user/config
and change the ‘gif’ settings. So, I did…
types:
...
gif:
type: image
thumb: media/thumb-gif.png
mime: image/gif
...
However, contrary to @pfodo ’s experience, the gif does animate correctly in my project.
NB. I’ve logged an issue on the fact that page.media.images
does not return gifs.