Code Sample: Keep GIF Animation When Adding Media to Post Content in WordPress

When you upload an animated GIF to WordPress, or well any sort of image file, WordPress will upload the full size then resize to an array of different settings for thumbnails and medium sizes.  The issue is when it is an animated GIF the resized items are just a still of the first frame.  WordPress doesn’t have a GIF processor for rebuilding each frame at different sizes.

There is a plugin out there, it’s a bit outdated but might still do the trick.  If you aren’t planning on having hundreds of gifs slowing down your site then this code snippet will force all gifs to load their full size image when using the “Add Media” button.  You can then resize it with your mouse in place.

Leave a Reply

Your email address will not be published. Required fields are marked *