Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Archive

(Animated) Gif won't show

Started by Muut Archive 9 years ago · 4 replies · 1678 views
9 years ago

Hi everyone,
I have a problem with gif files: somehow they are not recognized as Page Media. I tried the following scenario's

  1. I uploaded an animated gif. I can find the file in the post's folder, but it won't show on my page
  2. I uploaded a jpeg, to see if there was something wrong with page folder or something. There was no issue, the jpeg showed as it should.
  3. I uploaded a non-animated gif to check if the animated character of the first gif might cause the issue. But it seems not; the non-animated gif also doesn't show on the page.

I also checked the blueprint, but I don't see anything weird:

YAML
uploads:
  type: pagemedia
  label: PLUGIN_ADMIN.PAGE_MEDIA
  filesize: 3

All files are not bigger than 3MB.

What else can I check to find the cause for this issue?

Thanks for your advice in advance :)

9 years ago

I found another config file: /user/config/plugins/form.yaml. Here I have the following settings:

YAML
enabled: true
built_in_css: true
files:
  multiple: false
  limit: 10
  filesize: 5
  destination: self@
  avoid_overwriting: false
  random_name: false
  accept:
    - 'image/*'
9 years ago

After reading this forumpost, I found out gifs are not an image type. So now I want to loop through both the images and animated media of a page with the following code:

TWIG
<div class="grid-item">
  {% for image in page.media.images %}
    <a href="{{ image.url }}">
      <img src="{{ image.cropResize(480,600).url }}">
    </a>
  {% endfor %}
  {% for animated in page.media.animated %}
    <a href="{{ animated.url }}">
      <img src="{{ animated.resize(480, 600).html() }}">
    </a>
  {% endfor %}
</div>

The animated gifs are not found though. What am I doing wrong?

9 years ago

Sorry, forgot to update here that I got the solution. Antony suggested the same on Slack and it worked :) Thanks anyway!

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1282 9 years ago
Archive · by Muut Archive, 9 years ago
2 889 9 years ago
Archive · by Muut Archive, 9 years ago
2 4019 9 years ago
Archive · by Muut Archive, 9 years ago
1 2894 9 years ago
Archive · by Muut Archive, 9 years ago
3 1078 9 years ago