This plugin hasn’t been tested with the latest 3 major releases of WordPress. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.



When a user adds a new GIF to the Media library, or updates an existing GIF, GIF2HTML5 will start the image transformation process.

This plugin does not handle the actual file transformation routine. The transformation is handled by a standalone web application. GIF2HTML5 sends the URL of the GIF to the web application, and the web application responds asynchronously with a POST handled via admin_post.

When the GIF2HTML5 plugin receives the POST from the web application, it receives MP4, OGV, and WebM video URLs, and a poster image URL, and saves those as post meta fields of the GIF attachment.

The GIF2HTML5 plugin filters post content, and replaces img elements with video elements when the video file replacements are available.


The separate, standalone web application is a requirement. In order to set up the web application, you should clone it from the GitHub repository, and follow the setup instructions.

Once you have your web application running. You will need to set the gif2html5_api_url option to the /convert endpoint of your web application.

If you have your web application running on Heroku, setting the gif2html_api_url option might look like this:


set_option( ‘gif2html5_api_url’, ‘’ );

If you’ve chosen to secure your web application with an API key (the GIF2HTML5_API_KEY setting described here), then you will also need to set the gif2html5_api_key option.


set_option( ‘gif2html_api_key’, ‘secret-api-key’ );

Instead of storing these options directly in the database, it might be preferable to set them via a runtime pre_option_ filter like this:


define( ‘MYSITE_GIF2HTML5_API_URL’, ‘’ );
define( ‘MYSITE_GIF2HTML5_API_KEY’, ‘secret-api-key’ );

add_filter( ‘pre_option_gif2html5_api_url’, function() { return MYSITE_GIF2HTML5_API_URL } );
add_filter( ‘pre_option_gif2html5_api_key’, function() { return MYSITE_GIF2HTML5_API_KEY } );

Now you are ready to use the plugin.


The plugin defines four filters for altering the URLs of assets gif2html5_mp4_url, gif2html5_ogv_url, gif2html5_webm_url, gif2html5_snapshot_url. These filters can be used to modify the URLs returned from Gif2Html5::get_mp4_url, Gif2Html5::get_ogg_url, Gif2Html5::get_webm_url, Gif2Html5::get_snapshot_url respectively. Each filter is provided with the asset URL as the first argument, and the attachment ID as the second argument.

You might want to use these filters if you’ve configured a DNS name as an alias for the S3 bucket used by the image conversion service. Here’s how you might handle that situation:


define( ‘MYSITE_GIF2HTML5_URL_DOMAIN’, ‘’ );

function replace_gif2html5_url( $url ) {
$parsed_url = parse_url($url);
$paths = explode( ‘/’, $parsed_url[‘path’] );
return $parsed_url[‘scheme’] . ‘://’ . MYSITE_GIF2HTML5_URL_DOMAIN . ‘/’ . implode( ‘/’, array_slice( $paths, 2 ) );
add_filter( ‘gif2html5_mp4_url’, ‘replace_gif2html5_url’ );
add_filter( ‘gif2html5_ogv_url’, ‘replace_gif2html5_url’ );
add_filter( ‘gif2html5_webm_url’, ‘replace_gif2html5_url’ );
add_filter( ‘gif2html5_snapshot_url’, ‘replace_gif2html5_url’ );

Contributors & Developers

“GIF2HTML5” is open source software. The following people have contributed to this plugin.


Translate “GIF2HTML5” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.


0.1.0 (June 18, 2015)

  • Initial release.