1

I use a very basic setup of twentyseventeen and die most recent wp version. When I upload PNGs or JPGs they as a featured image, they are saved as a resized version on my uploads folder and used on the homepage and archive pages as a resized versions for the responsive images.

GIF files are also saved in the uploads folder but are not used as responsive image. Only the original size is referenced and loaded in HTML. The pixel dimension of my GIF is1920x890px:

https://marc.tv/wordpress-deployment-mit-mainwp-und-github/

Is there any reason for this behaviour? Why arn't the image sizes used if they exists as resized gif files generated by wordpress? I have no plugins installed. The gifs are not animated gifs.

2
  • What dimensions are the images? WordPress can crop and shrink images but can't make them bigger. If your image is too small it won't be blown up to fit the required size. Could that be the issue? Apr 12, 2018 at 12:24
  • It's 1920 x 800
    – Marc
    Apr 15, 2018 at 12:10

2 Answers 2

2

It seems to be a feature and not a bug: screen sizes are not added to scrset if you upload a gif as teaser image: https://core.trac.wordpress.org/ticket/34528 This applies only to teaser images and not images in the article.

I used 8-Bit PNG instead and now all scrset attributes are filled.

1

Twentyseventeen makes use of the wp_get_attachment_image_attributes hook to filter the default size attributes of thumbnails, as well as the wp_calculate_image_sizes filter, both of which affect the result of the the_post_thumbnail function which is used by the theme to display its thumbnails.

So likely your gif do not meet the size requirements and therefore default to the original size.

3
  • What do you mean by "size requirements"? It's 1920x1080px and 120kb in flle size. The different sizes have been generated by wordpress but wordpress or "the_post_thumbnail" does not use this sizes. What should I do or try? I don't want to revert back to JPG or PNG. Here is the url: marc.tv/wordpress-deployment-mit-mainwp-und-github
    – Marc
    Apr 13, 2018 at 12:48
  • @Marc, if you inspect the theme's functions.php file you will see the function sets the image size parameter based on the full width of your screen size. try to disable these function call (comment out the action hooks for the above hooks) to see how this affects your image size.
    – Aurovrata
    Apr 13, 2018 at 16:06
  • But it works with jpg and png of the same image pixel dimensions. Why not with GIF? There is no gif filter int the functions.php
    – Marc
    Apr 14, 2018 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.