Annoying wordpress.com gif auto resize


Recently on wordpress.com for another project, I had this problem with uploading gif image : there is a f*** auto resize embed in my theme that transforms my image tag


<img title="bugs" alt="bugs" 
src="https://blabla.files.wordpress.com/2012/bugs.gif">

in


<img title="bugs" alt="bugs" 
src="https://blabla.files.wordpress.com/2012/bugs.gif?w=479">

and therefore resize the gif on the fly with the ?w=479 in the end of the src and blocking the animation. Yes, the gif is not animated anymore. How stupid ?

So here is my dirty solution:

Replace the img tag in the HTML editor by :


<div style="
background-image:url('https://blabla.files.wordpress.com/2012/bugs.gif'); 
width:500px;
height:260px;">
</div>
<img style="display: none;" title="bugs" alt="bugs" 
src="https://blabla.files.wordpress.com/2012/bugs.gif?w=479">

Where, of course, width and height are your image dimensions.

Explanations:

The first <div> displays the image for the visitors

The style=”display: none;” in the image tag is hiding the image for the visitor, but not for crawlers and referencing. (If you don’t care about that, you can remove the image tag.)

Always, don’t forget the title and the alt attributes in your image ;)

Fab
Latest posts by Fab (see all)

About Fab

Solutions Architect, I build great workflows for the news and media production industries. I play with data too.

Leave a comment

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