How to prevent loading of GIF images and only authorize it when clicking a button? [duplicate]

1

Self-explanatory title "How do I prevent GIF images from being uploaded and only authorize it at the click of a button?".

    
asked by anonymous 16.07.2014 / 15:20

1 answer

3

You can use freezeframe for this, the other way is to have a static image of the gif animated, and via jQuery make the exchange of images.

It would look like this using two images:

JQuery

$(function(){
   $("img").click(function(){
      var gif = $(this).data('animate');
      $(this).attr('src', gif);
   });
});

HTML

<img src="/static/88855445.jpg" data-animate="/gif/88855445.gif" alt="" />

Clicking on the image will "start" the GIF

    
16.07.2014 / 15:30