skip to Main Content

I’m trying to add a GIF as a featured product image and it doesnt work properly. Let me recap :

  • A GIF can be used without a problem as a featured image if it’s 300×300 max (because WP doesnt resize it and doesnt freeze to the first frame).
  • The problem with this method is that the GIF is low quality and can’t be used effectively.

I’ve tried severals methods as changing how the resize function works, adding plugins like autofeatured image or even ImageMagick but nothing seems to work.

If you have any idea on how to resolve that issue feel free to help (been struggling for a week now ^^)

2

Answers


  1. I have found that, when you proceed as follows the gif does not get resized:

    1. go to Edit Page
    2. Select the "Featured Product" block on which you
      would like to add the gif
    3. click Replace
    4. click Upload
    5. Add your gif.

    Like this I have added gifs with 1920 x 2035 px successfully. I have not tested larger ones.

    Login or Signup to reply.
  2. // stop resizing gifs
    
    function wrdprss_disable_gif_resizing( $sizes, $metadata ) {
    
        // Get filetype data.
        $filetype = wp_check_filetype($metadata['file']);
    
        // Check if is GIF.
        if($filetype['type'] == 'image/gif') {
            // Unset sizes if file is gif.
            $sizes = array();
            console.log("Message here");
        }
    
        // Return sizes you want to create from image (None if image is GIF.)
        return $sizes;
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search