{"id":14295,"date":"2015-08-25T23:35:48","date_gmt":"2015-08-25T23:35:48","guid":{"rendered":"http:\/\/make.wordpress.org\/core\/?p=14295"},"modified":"2015-09-05T15:26:13","modified_gmt":"2015-09-05T15:26:13","slug":"responsive-image-support-update","status":"publish","type":"post","link":"https:\/\/make.wordpress.org\/core\/2015\/08\/25\/responsive-image-support-update\/","title":{"rendered":"Update: Responsive Image Support for Core"},"content":{"rendered":"<p>The responsive image team has been meeting regularly for a while. After our meeting earlier this week, we realized that make\/<span tabindex='0' class='glossary-item-container'>core<span class='glossary-item-hidden-content'><span class='glossary-item-header'>Core<\/span> <span class='glossary-item-description'>Core is the set of software required to run WordPress. The Core Development Team builds WordPress.<\/span><\/span><\/span> needs an update on what\u2019s been going on with the RICG (Responsive Images Community Group) <span tabindex='0' class='glossary-item-container'>feature plugin<span class='glossary-item-hidden-content'><span class='glossary-item-header'>Feature Plugin<\/span> <span class='glossary-item-description'>A plugin that was created with the intention of eventually being proposed for inclusion in WordPress Core. See <a href=\"https:\/\/make.wordpress.org\/core\/handbook\/about\/release-cycle\/features-as-plugins\/\">Features as Plugins<\/a><\/span><\/span><\/span>, as well as to request feedback on a few questions.<\/p>\n<p>Our meetings are in <a href=\"https:\/\/wordpress.slack.com\/messages\/feature-respimg\/\">#feature-respimg<\/a> each <a href=\"https:\/\/www.timeanddate.com\/worldclock\/fixedtime.html?iso=20260508T1900\"><abbr class=\"date\" title=\"2026-05-08T19:00:00+00:00\">Friday at 1900 UTC<\/abbr><\/a>, so please come and chat to give feedback or if you\u2019re interested in helping out!<\/p>\n<h2>Background<\/h2>\n<p>Several years ago, <a href=\"http:\/\/responsiveimages.org\/\">a ragtag group of web professionals<\/a>\u00a0identified a need for\u00a0new <span tabindex='0' class='glossary-item-container'>HTML<span class='glossary-item-hidden-content'><span class='glossary-item-header'>HTML<\/span> <span class='glossary-item-description'>HyperText Markup Language. The semantic scripting language primarily used for outputting content in web browsers.<\/span><\/span><\/span> markup\u00a0which would allow developers to\u00a0declare\u00a0multiple sources for an image\u2014allowing\u00a0devices to\u00a0select the image source that was most appropriate for its own <span tabindex='0' class='glossary-item-container'>capabilities<span class='glossary-item-hidden-content'><span class='glossary-item-header'>capability<\/span> <span class='glossary-item-description'>A\u00a0<strong>capability<\/strong>\u00a0is permission to perform one or more types of task. Checking if a user has a capability is performed by the <code>current_user_can<\/code> function. Each user of a WordPress site might have some permissions but not others, depending on their\u00a0role. For example, users who have the Author role usually have permission to edit their own posts (the \u201cedit_posts\u201d capability), but not permission to edit other users\u2019 posts (the \u201cedit_others_posts\u201d capability).<\/span><\/span><\/span>. Fast forward to today and all major browsers have either implemented these new tools or currently have them under consideration for development.<\/p>\n<p>With that as background,\u00a0the RICG has been working on an <a href=\"https:\/\/wordpress.org\/plugins\/ricg-responsive-images\/\"><em>Official WordPress Feature Plugin\u2122<\/em><\/a> to test the viability of adding responsive image support natively into WordPress. Specifically, our aim is to automatically add <code>srcset<\/code>\u00a0(using <code>w<\/code> descriptors) and <code>sizes<\/code> attributes to the image markup generated by WordPress. According to the <a href=\"https:\/\/wordpress.org\/plugins\/ricg-responsive-images\/stats\/\">WordPress.org plugin directory<\/a>, there are over 10k active installs, so we\u2019ve definitely seen an interest in this functionality.<\/p>\n<p>There are two main pieces of functionality included in the <span tabindex='0' class='glossary-item-container'>plugin<span class='glossary-item-hidden-content'><span class='glossary-item-header'>Plugin<\/span> <span class='glossary-item-description'>A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory <a href=\"https:\/\/wordpress.org\/plugins\/\">https:\/\/wordpress.org\/plugins\/<\/a> or can be cost-based plugin from a third-party.<\/span><\/span><\/span>, which can be considered separately for inclusion in core:<\/p>\n<ol>\n<li>Logic for producing responsive image markup<\/li>\n<li>Advanced image compression (via ImageMagick)<\/li>\n<\/ol>\n<h2>Responsive Image Markup<\/h2>\n<p>There is a lot to consider when proposing a change to the way WordPress outputs image markup, so I want to be clear about some of our assumptions going in:<\/p>\n<ul>\n<li>Responsive image support should be added \u2018invisibly\u2019 without introducing new settings for users to worry about.<\/li>\n<li>WordPress, out of the box, should only deal with resolution switching, and not the <a href=\"https:\/\/usecases.responsiveimages.org\/#art-direction\">art direction use case<\/a>\u00a0for now. In other words, we would not be adding any <span tabindex='0' class='glossary-item-container'>API<span class='glossary-item-hidden-content'><span class='glossary-item-header'>API<\/span> <span class='glossary-item-description'>An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways.<\/span><\/span><\/span> or <span tabindex='0' class='glossary-item-container'>admin<span class='glossary-item-hidden-content'><span class='glossary-item-header'>admin<\/span> <span class='glossary-item-description'>(and super admin)<\/span><\/span><\/span> <span tabindex='0' class='glossary-item-container'>UI<span class='glossary-item-hidden-content'><span class='glossary-item-header'>UI<\/span> <span class='glossary-item-description'>User interface<\/span><\/span><\/span> for outputting different cropped images at specific breakpoints. (For more information about use cases and all things\u00a0related to responsive images, I\u2019d recommend reading the terrific <a href=\"http:\/\/blog.cloudfour.com\/responsive-images-101-definitions\/\">Responsive Image 101<\/a>\u00a0series by Jason Grigsby).<\/li>\n<li>Provide this functionality using default and available user-defined sizes (via <code>add_image_size()<\/code>) for source sets rather than\u00a0creating\u00a0an additional set of crops. This choice is based on <a href=\"https:\/\/wordpress.slack.com\/archives\/feature-respimg\/p1419393836000051\">early feedback from Nacin<\/a>\u00a0regarding file-count concerns on some shared hosts.<\/li>\n<li>Provide <span tabindex='0' class='glossary-item-container'>filter<span class='glossary-item-hidden-content'><span class='glossary-item-header'>Filter<\/span> <span class='glossary-item-description'>Filters are one of the two types of Hooks <a href=\"https:\/\/codex.wordpress.org\/Plugin_API\/Hooks\">https:\/\/codex.wordpress.org\/Plugin_API\/Hooks<\/a>. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output.<\/span><\/span><\/span> <span tabindex='0' class='glossary-item-container'>hooks<span class='glossary-item-hidden-content'><span class='glossary-item-header'>Hooks<\/span> <span class='glossary-item-description'>In WordPress theme and development, hooks are functions that can be applied to an action or a Filter in WordPress. Actions are functions performed when a certain event occurs in WordPress. Filters allow you to modify certain functions. Arguments used to hook both filters and actions look the same.<\/span><\/span><\/span> so theme\/plugin authors can extend\/override defaults.<\/li>\n<li>All sizes of an image (i.e., <code>_wp_attachment_metadata['sizes']<\/code>) with the same aspect ratio are resized versions of the same image, not custom art directed crops. This assumption has been okay so far, but there may be be plugins that replace the default image sizes with art directed crops that maintain the same aspect ratio. We\u2019ll need to determine how to handle these cases.<\/li>\n<\/ul>\n<h3>Questions to Consider<\/h3>\n<ol>\n<li>How should we\u00a0handle markup embedded in post content?\n<ul>\n<li>Currently, we embed the\u00a0<code>srcset<\/code>\u00a0attribute directly into posts with\u00a0<code>sizes<\/code>\u00a0added as a data attribute to make it easier for\u00a0theme authors to filter the\u00a0<code>sizes<\/code> attribute later. It\u2019s tricky to decide when it\u2019s appropriate to add layout relative markup to the database, but WordPress is currently doing this to a certain extent by adding width\/height attributes to images, so this may be the best solution for now.<\/li>\n<li>Instead, a more elegant solution\u00a0would be to\u00a0filter the content on output. This would avoid saving\u00a0layout markup in\u00a0the database, and extend support\u00a0to posts with images that were published before the feature became available. We have <a href=\"https:\/\/github.com\/ResponsiveImagesCG\/wp-tevko-responsive-images\/pull\/144\/files\">a proof of concept<\/a>\u00a0but are unsure if adding another filter to <code>the_content<\/code> is appropriate. Confirmation either way on this question would help us move forward.<\/li>\n<\/ul>\n<\/li>\n<li>Should we support <code>srcset<\/code> and <code>sizes<\/code> in older browsers?\n<ul>\n<li>The plugin\u00a0includes the\u00a0<a href=\"https:\/\/scottjehl.github.io\/picturefill\/\">picturefill.js<\/a>\u00a0polyfill, which provides\u00a0support for older browsers, but would be a new dependency for core.<\/li>\n<li>We could view <code>srcset<\/code> and <code>sizes<\/code> as a progressive <span tabindex='0' class='glossary-item-container'>enhancement<span class='glossary-item-hidden-content'><span class='glossary-item-header'>enhancement<\/span> <span class='glossary-item-description'>Enhancements are simple improvements to WordPress, such as the addition of a hook, a new feature, or an improvement to an existing feature.<\/span><\/span><\/span> and only provide support in WordPress for newer browsers. In that case, we could drop the polyfill and save WordPress an extra <span tabindex='0' class='glossary-item-container'>JS<span class='glossary-item-hidden-content'><span class='glossary-item-header'>JS<\/span> <span class='glossary-item-description'>JavaScript, a web scripting language typically executed in the browser. Often used for advanced user interfaces and behaviors.<\/span><\/span><\/span> dependency. Note that this polyfill is written by the same people writing and implementing the spec. We consider it to be very reliable.<\/li>\n<\/ul>\n<\/li>\n<li>Should\u00a0we turn responsive image support on by default?\n<ul>\n<li>\u201cDecisions not options.\u201d We propose that responsive images are enabled by default in core, with filters provided for disabling or modifying the feature.<\/li>\n<li>If core does not want responsive images enabled by default, they could be enabled through a <code>current_theme_supports()<\/code> flag. Themes would have to \u201copt-in\u201d to the feature.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h2>Advanced Image Compression<\/h2>\n<p>The second potential\u00a0enhancement introduced through our plugin\u00a0is an improvement to the default ImageMagick compression settings currently being used in core. RICG contributor Dave Newton has done great\u00a0research on the <a href=\"http:\/\/www.smashingmagazine.com\/2015\/06\/efficient-image-resizing-with-imagemagick\/\">best compression settings for ImageMagick<\/a>, and included them as an opt-in option within the plugin.<\/p>\n<p>The updated settings are absolutely <em>killer<\/em> when there are sufficient CPU and memory resources on the host server. In our trials, <a href=\"http:\/\/www.smashingmagazine.com\/2015\/06\/efficient-image-resizing-with-imagemagick\/#the-results-or-is-this-even-worth-it\">file sizes have decreased by &gt;50%<\/a> compared to the default core settings.<\/p>\n<p>However, on limited servers, these new settings could cause problems. We are iterating on them to find the right balance between the file-size savings and the CPU resources required to process large files.<\/p>\n<h2>Final Notes<\/h2>\n<p>We need your help!<\/p>\n<p>New features need lots of feedback and testing. Help us test these enhancements by installing the <a href=\"https:\/\/wordpress.org\/plugins\/ricg-responsive-images\/\">latest version of the plugin<\/a> from <span tabindex='0' class='glossary-item-container'>WordPress.org<span class='glossary-item-hidden-content'><span class='glossary-item-header'>WordPress.org<\/span> <span class='glossary-item-description'>The community site where WordPress code is created and shared by the users. This is where you can download the source code for WordPress core, plugins and themes as well as the central location for community conversations and organization.  <a href=\"https:\/\/wordpress.org\/\">https:\/\/wordpress.org\/<\/a><\/span><\/span><\/span>.<\/p>\n<p>Be sure to enable advanced image compression and tell us how it does with your setup so we can gather more feedback.<\/p>\n<p>If you know of plugins that heavily modify or interact with custom image sizes or art-directed crops, please leave a comment below so we can test it with this feature.<\/p>\n<p>Have thoughts on the questions above? Let us know in the comments!<\/p>\n<p>Want to get involved? We meet each week in <a href=\"https:\/\/wordpress.slack.com\/messages\/feature-respimg\/\">#feature-respimg<\/a> on <a href=\"https:\/\/www.timeanddate.com\/worldclock\/fixedtime.html?iso=20260508T1900\"><abbr class=\"date\" title=\"2026-05-08T19:00:00+00:00\">Friday at 1900 UTC<\/abbr><\/a>.<\/p>\n<p class=\"o2-appended-tags\"><a href=\"https:\/\/make.wordpress.org\/core\/tag\/feature-plugins\/\" class=\"tag\"><span class=\"tag-prefix\">#<\/span>feature-plugins<\/a>, <a href=\"https:\/\/make.wordpress.org\/core\/tag\/media\/\" class=\"tag\"><span class=\"tag-prefix\">#<\/span>media<\/a>, <a href=\"https:\/\/make.wordpress.org\/core\/tag\/respimg\/\" class=\"tag\"><span class=\"tag-prefix\">#<\/span>respimg<\/a>, <a href=\"https:\/\/make.wordpress.org\/core\/tag\/updates\/\" class=\"tag\"><span class=\"tag-prefix\">#<\/span>updates<\/a><\/p><nav class='o2-post-footer-actions'><ul class='o2-post-footer-action-row'><\/ul><div class='o2-post-footer-action-likes'><\/div><ul class='o2-post-footer-action-row'><\/ul><\/nav>","protected":false},"excerpt":{"rendered":"<p>The responsive image team has been meeting regularly for a while. After our meeting earlier this week, we realized that make\/coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. needs an update on what\u2019s been going on with the RICG (Responsive Images Community Group) feature pluginFeature Plugin [&hellip;]<\/p>\n","protected":false},"author":381024,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1171,1172],"tags":[394,1397,1483,393],"class_list":["post-14295","post","type-post","status-publish","format-standard","hentry","category-feature-plugins","category-updates","tag-feature-plugins","tag-media","tag-respimg","tag-updates","author-joemcgill"],"revision_note":"","jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2AvED-3Iz","_links":{"self":[{"href":"https:\/\/make.wordpress.org\/core\/wp-json\/wp\/v2\/posts\/14295","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/make.wordpress.org\/core\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/make.wordpress.org\/core\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/make.wordpress.org\/core\/wp-json\/wp\/v2\/users\/381024"}],"replies":[{"embeddable":true,"href":"https:\/\/make.wordpress.org\/core\/wp-json\/wp\/v2\/comments?post=14295"}],"version-history":[{"count":34,"href":"https:\/\/make.wordpress.org\/core\/wp-json\/wp\/v2\/posts\/14295\/revisions"}],"predecessor-version":[{"id":14384,"href":"https:\/\/make.wordpress.org\/core\/wp-json\/wp\/v2\/posts\/14295\/revisions\/14384"}],"wp:attachment":[{"href":"https:\/\/make.wordpress.org\/core\/wp-json\/wp\/v2\/media?parent=14295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/make.wordpress.org\/core\/wp-json\/wp\/v2\/categories?post=14295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/make.wordpress.org\/core\/wp-json\/wp\/v2\/tags?post=14295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}