{"id":35968,"date":"2015-06-18T16:34:14","date_gmt":"2015-06-18T16:34:14","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/gif2html5\/"},"modified":"2015-08-27T00:10:43","modified_gmt":"2015-08-27T00:10:43","slug":"gif2html5","status":"closed","type":"plugin","link":"https:\/\/wordpress.org\/plugins\/gif2html5\/","author":183657,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"0.1.0","stable_tag":"0.1.0","tested":"4.3.34","requires":"4.2","requires_php":"","requires_plugins":"","header_name":"GIF2HTML5","header_author":"Fusion Engineering and community","header_description":"","assets_banners_color":"","last_updated":"2015-08-27 00:10:43","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"","header_author_uri":"http:\/\/fusion.net\/section\/tech-product\/","rating":0,"author_block_rating":0,"active_installs":10,"downloads":1603,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":0},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["0.1.0"],"block_files":[],"assets_screenshots":[],"screenshots":[]},"plugin_section":[],"plugin_tags":[2198,163,247,6334],"plugin_category":[50,54],"plugin_contributors":[77514,79640,79635,91892,91893],"plugin_business_model":[],"class_list":["post-35968","plugin","type-plugin","status-closed","hentry","plugin_tags-gif","plugin_tags-images","plugin_tags-performance","plugin_tags-videos","plugin_category-media","plugin_category-security-and-spam-protection","plugin_contributors-danielbachhuber","plugin_contributors-davisshaver","plugin_contributors-fusionengineering","plugin_contributors-mpatek","plugin_contributors-noppanit","plugin_committers-danielbachhuber","plugin_committers-goldenapples"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/gif2html5.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>When a user adds a new GIF to the Media library, or updates an existing GIF, GIF2HTML5 will start the image transformation process.<\/p>\n\n<p>This plugin does not handle the actual file transformation routine. The transformation is handled by a <a href=\"https:\/\/github.com\/fusioneng\/gif2html5-app\">standalone web application<\/a>. GIF2HTML5 sends the URL of the GIF to the web application, and the web application responds asynchronously with a POST handled via <code>admin_post<\/code>.<\/p>\n\n<p>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.<\/p>\n\n<p>The GIF2HTML5 plugin filters post content, and replaces <code>img<\/code> elements with <code>video<\/code> elements when the video file replacements are available.<\/p>\n\n<!--section=installation-->\n<p>The <a href=\"https:\/\/github.com\/fusioneng\/gif2html5-app\">separate, standalone web application<\/a> is a requirement. In order to set up the web application, you should clone it from the GitHub repository, and follow the setup instructions.<\/p>\n\n<p>Once you have your web application running. You will need to set the <code>gif2html5_api_url<\/code> option to the <code>\/convert<\/code> endpoint of your web application.<\/p>\n\n<p>If you have your web application running on Heroku, setting the <code>gif2html_api_url<\/code> option might look like this:<\/p>\n\n<pre><code>`PHP\n<\/code><\/pre>\n\n<p>set_option( 'gif2html5_api_url', 'https:\/\/my-web-app.herokuapp.com\/convert' );\n    `<\/p>\n\n<p>If you've chosen to secure your web application with an API key (the GIF2HTML5_API_KEY setting described <a href=\"https:\/\/github.com\/fusioneng\/gif2html5-app#configuration\">here<\/a>), then you will also need to set the <code>gif2html5_api_key<\/code> option.<\/p>\n\n<pre><code>`PHP\n<\/code><\/pre>\n\n<p>set_option( 'gif2html_api_key', 'secret-api-key' );\n    `<\/p>\n\n<p>Instead of storing these options directly in the database, it might be preferable to set them via a runtime <code>pre_option_<\/code> filter like this:<\/p>\n\n<pre><code>`PHP\n<\/code><\/pre>\n\n<p>define( 'MYSITE_GIF2HTML5_API_URL', 'https:\/\/my-web-app.herokuapp.com\/convert' );\ndefine( 'MYSITE_GIF2HTML5_API_KEY', 'secret-api-key' );\n...\nadd_filter( 'pre_option_gif2html5_api_url', function() { return MYSITE_GIF2HTML5_API_URL } );\nadd_filter( 'pre_option_gif2html5_api_key', function() { return MYSITE_GIF2HTML5_API_KEY } );\n    `<\/p>\n\n<p>Now you are ready to use the plugin.<\/p>\n\n<h4>Filters<\/h4>\n\n<p>The plugin defines four filters for altering the URLs of assets <code>gif2html5_mp4_url<\/code>, <code>gif2html5_ogv_url<\/code>, <code>gif2html5_webm_url<\/code>, <code>gif2html5_snapshot_url<\/code>. These filters can be used to modify the URLs returned from <code>Gif2Html5::get_mp4_url<\/code>, <code>Gif2Html5::get_ogg_url<\/code>, <code>Gif2Html5::get_webm_url<\/code>, <code>Gif2Html5::get_snapshot_url<\/code> respectively. Each filter is provided with the asset URL as the first argument, and the attachment ID as the second argument.<\/p>\n\n<p>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:<\/p>\n\n<pre><code>`PHP\n<\/code><\/pre>\n\n<p>define( 'MYSITE_GIF2HTML5_URL_DOMAIN', 'assets.mysite.com' );\n...\nfunction replace_gif2html5_url( $url ) {\n    $parsed_url = parse_url($url);\n    $paths = explode( '\/', $parsed_url['path'] );\n    return $parsed_url['scheme'] . ':\/\/' . MYSITE_GIF2HTML5_URL_DOMAIN . '\/' . implode( '\/', array_slice( $paths, 2 ) );\n}\nadd_filter( 'gif2html5_mp4_url', 'replace_gif2html5_url' );\nadd_filter( 'gif2html5_ogv_url', 'replace_gif2html5_url' );\nadd_filter( 'gif2html5_webm_url', 'replace_gif2html5_url' );\nadd_filter( 'gif2html5_snapshot_url', 'replace_gif2html5_url' );\n    `<\/p>\n\n<!--section=changelog-->\n<h4>0.1.0 (June 18, 2015)<\/h4>\n\n<ul>\n<li>Initial release.<\/li>\n<\/ul>","raw_excerpt":"GIF2HTML5 transforms animated GIF attachments to HTML5 video, using a separate application, and displays the HTML5 video in place of the original GIF.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/35968","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=35968"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/danielbachhuber"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=35968"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=35968"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=35968"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=35968"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=35968"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=35968"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}