'Is there a way to stop autoplay on .gifs in a backgroundImage?

For a project I have a div which contains an image <div class="postCard" style="background-image: url(<?=$url ?? "./style/assets/placeHolder.png"?>)"></div>

As of now users can upload gifs as an background image as well, but it's not user friendly to play dozens of gifs at the same time. For this reason I want to disable autoplay of these .gifs.

I can't find a way to do this natively and the existing solutions such as libgif JS don't allow for background images.

is there any other way I can solve this problem without having a stock image to replace them or removed the BackgroundImage?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source