Introducing handling of big images in WordPress 5.3

The way WordPress handles large images has always been a topic of discussion for users and developers.

There are generally two types of images that are uploaded:

  • Images that have been edited or created in an image editing application.
  • Photos that are uploaded either directly from the camera or haven’t been edited.

In the first case, the images are usually “web-ready”. They may have been scaled down to an appropriate size and optimized.

In the second case, the images are usually much bigger than needed and are not optimized for web use. A photo taken with an average modern smartphone is easily over 5MB in file size. Photos taken with a good quality camera can be much larger.

WordPress 5.3 introduces a new way to manage these images by detecting big images and generating a “web-optimized maximum size” of them.

How does it work?

When a new image is uploaded, WordPress will detect if it is a “big” image by checking if its height or its width is above a big_image threshold. The default threshold value is 2560px, filterable with the new big_image_size_threshold filter.

If an image height or width is above this threshold, it will be scaled down, with the threshold being used as max-height and max-width value. The scaled-down image will be used as the largest available size.

In this case, the original image file is stored in the uploads directory and its name is stored in another array key in the image meta array: original_image. To be able to always get the path to an originally uploaded image a new function wp_get_original_image_path() was introduced.

Disabling the scaling

The scaling is controlled by the big_image_size_threshold filter. Returning false from the filter callback will disable it.

add_filter( 'big_image_size_threshold', '__return_false' );

For reference on this change, see Trac ticket #47873 and changesets [46076] and [46353].

#5-3, #core-media, #dev-notes

Media Meeting Recap – September 19, 2019

The following is a summary of the weekly media component meeting that occurred on Thursday, September 19, 2019. Weekly media meetings are held every Thursday at 13:00 UTC. A full transcript can be found here in the #core-media room in the Make WordPress Slack.

Attendees: @anevins, @joemcgill , @FahimMurshed, @mikeschroder, @antpb, @afercia

Media Focus update: @mikeschroder has been hard at work on a 5.3 intro post. In it will be a focus on calling for testing.  Coming soon!

Add width and height attributes to <img> elements – https://github.com/WordPress/gutenberg/issues/6652
Discussion is taking place in this Slack thread. Maintainers in attendance all agreed that this would be great to be considered a bug and a potential impactful improvement to the editor experience. @joemcgill said, “Realistically, I think a first step is just adding a proof of concept that modifies the save attribute of the image block so the h/w attributes are always saved and then see what breaks.”

5.3 Ticket Triage

#47120Media modals: Upload errors and field information are not associated with their control : @antpb has taken ownership of the ticket and will investigate how we would best inject the recommended code into the various buttons/views.

#47137Insufficient form semantics : This issue was split into two issues (the other below) to allow the overall problem to improve in pieces. Ownership for this one is needed. It’s a bit of a tough issue that no one has yet to see an immediate solution.

#48028Media Library ‘featured image’ dialogue missing link text that describes ‘opens in new tab’.@afercia said “I think there’s the need to check how editState is implemented in the post frame and what is intended for. That implementation completely lacks in other frames. I think this is for historical reasons because the post frame was the only frame supposed to be used in the “edit post” context.” and @joemcgill responded “The classic editor used the Post frame in most places, rather than the Select frame. Now that most of Gutenberg is using the Select frame, some odd bits aren’t working the same—just like that other featured image bug you (@antpb) just fixed” @antpb assigned the issue to himself given his recent exposure to the featured image frames. A github issue is needed also to track this change in the Gutenberg plugin @antpb is working on that. More to come!

#47144Text inadvertently rendered by assistive technologies – Was mentioned at end of meeting but discussion was not able to be had. This issue is in need of ownership for the 5.3 release.

#47611Media views: hide the “file upload button” from assistive technologies – Was mentioned at end of meeting but discussion was not able to be had. This issue is in need of ownership for the 5.3 release.

Bug Scrubs next week!

@mikeschroder and @antpb have offered to lead two bug scrubs in #core-media next week to find ownership for the remaining accessibility issues planned for the 5.3 milestone:

Feedback

If you have any feedback on the above, please feel free to leave a comment, join in #core-media for a chat, or attend the next meeting on September 26, 2019 at 1300UTC!

#core, #core-accessibility, #core-media, #media, #summary

Media Meeting Recap – September 5, 2019

The following is a summary of the weekly media component meeting that occurred on Thursday, September 5, 2019. Weekly media meetings are held every Thursday at 13:00 UTC. A full transcript can be found here in the #core-media room in the Make WordPress Slack.

Attendees: @anevins, @sergeybiryukov, @pstonier , @afercia, @francina, @mikeschroder

Media Focus Lead for 5.3

Much like the 5.0 release, 5.3 will have many designated release leads around each focus/component in the project. 5.3 is right around the corner and now is the time for a decision to be made on a release lead representing the Media component. Previously @antpb had offered to take on the role if no others were interested. In this weeks Media meeting, a volunteer emerged! @mikeschroder has graciously offered to take on this role. Thanks Mike! Mike is in the JST time zone. This brings an awesome opportunity to have global representation in the team. @antpb has offered to help with relaying information or representing where time zones do not conveniently meet for Mike.

5.3 Ticket Triage

#47135 – Drag and drop functionality unavailable to keyboard or touchscreen — It was determined by the team that this issue exists more globally in meta boxes. It was deemed appropriate to document the information from the Media focused instance of this in an existing ticket on the issue: #39074 No method to move meta boxes using keyboard which was also given the keyword wpcampus-report for tracking purposes.

#47137 Insuficient form semantics – @anevins asked “Is there a technical reason why there isn’t a form element being used around that attachments browser code? That would defeat all of the remediation advice.” @afercia had these recommendations: “Ideally it should be a form because that helps in establishing semantic relationships. However, the sidebar is not rendered in all the views, so including the select area, the attachments list and the sidebar within one form might be a bit complicated.
The list of attachments is perceived as a list of checkboxes so it makes sense to wrap it within a fieldset + legend. I’d tend to think it would need more work in the future because yes, it’s a group of checkboxes but it actually works like a mini-application with custom interaction. I’d say fieldset + legend would help, for now.”

Triage on unanswered tickets continued after the meeting closed, and can be followed here.

Feedback

If you have any feedback on the above, please feel free to leave a comment, join in #core-media for a chat, or attend the next meeting on September 12, 2019 at 1300UTC!

#core, #core-accessibility, #core-media, #media, #summary

Media Meeting Recap – August 29, 2019

The following is a summary of the weekly media component meeting that occurred on Thursday, August 29, 2019. Weekly media meetings are held every Thursday at 13:00 UTC. A full transcript can be found here in the #core-media room in the Make WordPress Slack.

Attendees: @joemcgill, @anevins, @desrosj, @horttcore, @paaljoachim, @mikeschroder

5.3 Tickets

@azaozz requested review on the latest patches in #43524, #47873, #47872, #32437. He plans to commit them before the end of the week.

Chatting About Sizes

@pierlo asked for a discussion on #43524, which is about adding an additional image size.

Folks seemed to agree that it makes sense to add another one, and that it’d be great if sizes could be backfilled in the future, but that’s likely not for 5.3.

Connected to that, there was a conversation about the direction WordPress could take with sizes in 5.4 and beyond. Things discussed included a feature like add_image_size for attachments, delivering srcset sizes based on file size, and resizing after theme change.

If that sounds interesting, you can read the whole discussion here.

Ticket Triage

  • #47215: The media that is “Unattached” is different in list mode vs grid mode — @desrosj was able to reproduce, and is going to do a bit more testing.
  • #47215: The media that is “Unattached” is different in list mode vs grid mode — @joemcgill notes that this is an intentional behavior, meant to avoid clutter in the media library due to site icons or headers. This may need to be revisited.
  • #47364: Docs: Standardise the description for image size parameters — @joemcgill agreed to review the ticket and clarify the goals.
  • #47444: Deprecate the caption field from the media modal — Folks present noted use-cases for this, and @joemcgill to leave a comment.

Triage on unanswered tickets continued after the meeting closed, and can be followed here.

Feedback

If you have any feedback on the above, please feel free to leave a comment, join in #core-media for a chat, or attend the next meeting on September 5, 2019 at 1300UTC!

#core, #core-accessibility, #core-media, #media, #summary

Media Meeting Recap – August 23, 2019

The following is a summary of the weekly media component meeting that occurred on Thursday, August 23, 2019. Weekly media meetings are held every Thursday at 13:00 UTC. A full transcript can be found here in the #core-media room in the Make WordPress Slack.

Attendees: @joemcgill, @anevins, @pbiron, @desrosj

5.2.3 Media Tickets

All relevant tickets have been closed. 🎉 Props @sergeybiryukov on back-porting bug fixes.

5.3.0 Release Media Lead

Following up on the 5.3.0 Release Schedule and Scope, we were asked to identify a Media release lead. To coordinate media related tickets.

  • @antpb has expressed interest in doing this again, but wanted to open up the opportunity to anyone else interested.
  • @joemcgill wondered if this role was redundant with @azaozz role as Core technical lead, since most of the priority Media items are ones he is already working on.

If you’re interested in volunteering for this role, feel free to comment here, in #core-media, or DM @joemcgill or @antpb directly in Slack.

5.3.0 Tickets

  • #47156: Consider a way to clear the wp.a11y.speak() live regions – @anevins followed up and noted that the Drupal a11y team have a similar issue and this might be a limitation of aria-live regions, generally. The plan is to follow up with the #core-accessibility team this week.
  • #44581: users without ‘edit_posts’ capability never get informed that their uploads succeed – @pbiron asked that this get moved into the 5.3 release for review.
  • #47872: Try to create image sub-sizes again when uploading fails with a PHP fatal error – @azaozz asked for review, noting that testing requires the client to re-try creation of image sub-sizes after uploading an image and the server “crashes” with HTTP 500 error.
  • #40439: Save progress of intermediate image creation after upload – @azaozz believes this is complete, but would like more testing before closing.
  • #47873: Introduce handling of “Big Images” – @azaozz added as a new enhancement. Feedback appreciated.
  • #40175: Upload Validation / MIME Handling – @joemcgill noted that this stalled out after 5.2 and with the focus for 5.3 being on improving handling of large image uploads, would need to be punted to a future release unless someone else wants to pick it up for 5.3.
  • #35725: Add mime-type for Webp – @joemcgill doesn’t think #40175 should be a blocker for this ticket, but wasn’t sure if it should be in core without full browser support.

#core, #media, #summary

Media Meeting Recap – August 15, 2019

Overview

The following is a summary of the weekly media component meeting that occurred on Thursday, August 15, 2019. Weekly media meetings are held every Thursday at 13:00 UTC. A full transcript can be found here in the #core-media room in the Make WordPress Slack.

Attendees: @joemcgill, @anevins, @sergey, @antpb, @adamsilverman

5.3 A11y Related Tickets

@anevins lead a triage of the a11y related tickets from the WPCampus audit for 5.3 to try and make sure everything had an owner and/or some next steps to move forward.

Now that all tickets have been triaged, @joemcgill suggested that we keep the latest information in Trac so we can use this report to track status of the a11y related tickets throughout the 5.3 cycle.

5.3 Release Media Lead

@antpb asked if anyone was interested in being the Media lead for the 5.3 release. He served in this capacity for the 5.0 release and is willing to do so again for 5.3 if needed. @joemcgill reached out to @chanthaboune in #core following the meeting to clarify what this role would be responsible for (see chat). Essentially, this person would be the primary person responsible for communicating status from the component team and gathering consensus when decisions need to be made. This person is not responsible for completing all the work themselves, but should be leaning on the rest of the component maintainers and contributors to meet our release goals.

If you’re interested in volunteering for this role, feel free to comment here or in #core-media.

5.2.3 Release Tickets

@joemcgill noted that there are several Media issues listed in @jeffpaul‘s 5.2.3 release proposal. These need to be reopened as fixed-major so they can be back ported to the minor release and the milestone needs to be updated. @joemcgill volunteered to handle this.

#media, #summary

Dev chat summary: July 17

@earnjam led the meeting. @marybaum took notes and is writing this summary.

Announcements

Gutenberg 6.1

@earnjam announced the release of Gutenberg 6.1 last week. New features include animations/motion to block reordering, improved messaging for REST API errors and more.

Check out the release post for more details: https://make.wordpress.org/core/2019/07/10/whats-new-in-gutenberg-10-july/

Look for version 6.2 RC to land next week.

PHP Coding Standards

@pento posted a followup to some proposed coding standards changes from a few months back.
See the decisions on these changes here (they might surprise you!): https://make.wordpress.org/core/2019/07/12/php-coding-standards-changes/

And keep in mind these affect only the code for WordPress Core. In your own Themes and Plugins, use the coding conventions that make sense for you.

Releases

5.2.3

With four tickets in the queue and none of them affecting functionality, it’s still not clear that they warrant a separate 5.2.3 release. Scheduling for that is still pending further info on a roadmap for 5.3, which should land in early fall.

5.3

As yet the Core team is progressing on current open tickets — there are 57 in the queue — while @chanthaboune continues gathering data from component maintainers on feature priorities for 5.3.

Component maintainer updates

Core-media

@azaozz asked for more eyes on #40439.

If you can help test, please check out the ticket or head to #core-media.

Site-health

@clorith pointed to the call for input for bumping the PHP recommendation and said that soon a Make blogpost will outline next steps—and next versions.

For now, the site-health team isn’t looking to raise the hard minimum. This will be a soft bump up to nudge users toward the minimums that will follow.

Open Floor

Triage Team

@joyously asked about progress from the Triage Team, and the responses came from several quarters.

@desrosj posted a link to his three-month summary: https://jonathandesrosiers.com/2019/06/wordpress-triage-team-3-month-reflection/ and plans to post more often on https://make.wordpress.org/updates.

@karmatosed mentioned that Design holds two triages a week, and that from where she sits, triage seems to be going gangbusters and spreading across the WordPress Project.

@azaozz pointed the group to his efforts on TinyMCE: https://core.trac.wordpress.org/query?status=accepted&status=assigned&status=new&status=reopened&status=reviewing&component=TinyMCE&order=priority

@marybaum mentioned having been in an accessibility triage last Friday.

Gutenberg Phase 2

Newcomer @Lu asked about the timing of Gutenberg Phase 2, with a particular interest in widget blocks. @earnjam answered with a summary of the release discussion earlier in the chat.

Strings

@marybaum asked the group for their thoughts on a more systematic, global approach to the copy in strings.

For now, the group agreed to have #meta add two keywords to tickets—needs-copy-review and has-copy-review.

Props to @garrett-eclipse, who opened meta#4609 and its counterpart meta#4610 on the spot.

Right at the close of the official chat, @audrasjb linked to https://make.wordpress.org/core/handbook/best-practices/post-comment-guidelines/#style-and-substance

#dev-chat, #gutenberg, #releases, #strings, #triage-team

#summary

Media Meeting Recap – January 17, 2019

Overview

This post is a summary of the latest weekly Media component meeting, which took place in the #core-media Slack channel, on Thursday, January 17, 2019 at 21:00 UTC. The purpose of these meetings are to move priority tasks forward, provide feedback on issues of interest, and review media focused issues.

Attendees: @joemcgill @mikeschroder @karmatosed @desrosj @antpb @aaroncampbell @designsimply

Transcript: Read on Slack

5.1.0 Triage

Earlier in the day, @aaroncampbell, @mikeschroder, and @desrosj cleared the list of tickets reported against trunk awaiting review.

During the meeting, attendees scrubbed the remaining Media tickets in the 5.1.0 milestone.

  • #40590: wp_video_shortcode always adds controls=”controls”: The team wasn’t confident in the current approach. Punted to future release.
  • #45407: Add block attributes to wp_calculate_image_sizes to allow for proper handling of sizes attribute: This doesn’t seem to be ready for 5.1 but @joemcgill will make a final determination this week.
  • #40175: Upload Validation / MIME Handling: @joemcgill uploaded a patch this week. @pento reviewed and this will likely fall out of 5.1 and be marked for early 5.2. Testing/feedback is appreciated.
  • #44563: WordPress 4.9.7 Media delete changes break plugins deleting media via stream wrappers: No movement this week, punted to future release.
  • #44760: Media library module dates filter doesn’t fully display: @mikeschroder is owning and will either commit or punt.
  • #44836: Uploaded plugin installation page: There is an extra tag messing with a link: No movement. Punted to future release.
  • #45633: finfo_file() returns text/plain for json file instead of application/json: This is punted to future release, pending #40175.
  • #43826: get_post_galleries() should return gallery blocks: This remains a blessed task for now.
  • #45707: Add parameter $real_mime to wp_check_filetype_and_ext: This might land as a relief while #40175 is pending, as long as it doesn’t introduce future compatibility challenges.

Recent Trac Bulk Edit

The team discussed how we should handle the recent bulk edit closing of tickets. Of the tickets closed, 163 are Media component tickets. The general consensus is that we shouldn’t leave them as wontfix but no final decisions were made. Next steps are for everyone to leave feedback on the original P2 about how to handle this project wide, and we will plan to make a decision about Media tickets next week.

Next meeting

The next #core-media meeting is set for Thursday, January 24, 2019, 21:00 UTC. Leave any agenda suggestions in the comments of this post. See you there!

#media, #summary

Media Meeting Recap – January 3, 2019

Overview

This post is a summary of the latest weekly Media component meeting, which took place in the #core-media Slack channel, on Thursday, January 3, 2019 at 21:00 UTC. The purpose of these meetings are to move priority tasks forward, provide feedback on issues of interest, and review media focused issues.

Attendees: @joemcgill @mikeschroder @karmatosed @desrosj @paaljoachim @tellyworth

Transcript: Read on Slack

5.0.3 Triage

  • #43826: get_post_galleries() should return gallery blocks – Patch needs refresh, @desrosj to coordinate with @tellyworth about landing this.
  • #44563: WordPress 4.9.7 Media delete changes break plugins deleting media via stream wrappers – Also needs a refresh, @joemcgill to try and validate and make a decision unless @mikeschroder beats him to it. Lower priority though, so might punt.
  • #45407: Add block attributes to wp_calculate_image_sizes to allow for proper handling of sizes attribute – Unsure if this patch is ready to land. @joemcgill to investigate and make a decision. – #45615: CSV Mime Type fails upload – @joemcgill and @tellyworth continue working on a fix for this. Might try for a small fix for 5.0.3 and a larger refactor for 5.1.
  • #45633: finfo_file() returns text/plain for json file instead of application/json – Related to the above issue. @joemcgill to investigate.

Ongoing Cruft removal

On December 21, we discussed identifying potential places to clean up cruft that has built up over the years. So far, that post includes the following possibilities:

  • Fully supporting or deprecating playlist functionality
  • Removing infinite scroll in the media library.
  • Auditing/updating supported upload file types.
  • Removing old Thickbox code (#10955).
  • Functionality deprecated when WP_Image_Editor landed.
  • Auditing oEmbed providers.

Upcoming 5.1 ticket scrub

As of the time of this meeting, there were 38 open Media tickets on the 5.1 milestone. Of those, 16 are enhancements or feature requests that would need to land before next Thursday when 5.1 hits beta in order to be included. We’ll plan to do a scrub of this list in #core-media on Slack next Tuesday, January 8, 2019 at 20:00 UTC to assign/punt as much as possible. Feel free to come join in the fun!

Next meeting

The next #core-media meeting is set for Thursday, January 10, 2019, 21:00 UTC. This next meeting will be focused on triage and 5.1 priorities. See you there!

#media, #summary

Dev Chat Summary: November 28th (5.0 Week 9)

This post summarizes the dev chat meeting from November 28th (agenda, Slack archive).

5.0 Planning and Updates

  • We started with a reminder that RC1 is out and moved quickly into a lively discussion about remaining blockers, timing, and general logistics. I’ve summarized them the best I could below.
    • There was a request for review on one outstanding item in the default theme.
    • There were requests for consideration on 11973, 6177, and 45407 in media. These tickets are largely about how to best handle responsive images, specifically some nuance around the sizes attribute.
    • There are no automated tests for expected vs actual behavior
    • This affects only new posts, or newly edited posts.
    • It’s related to full-width images in the new editor and further complicated by the lack of any way to filter for block alignment width.
    • There are concerns about high data usage and negative impacts on search engines (esp for mobile)
    • Q: If we fix this in 5.0.x, what happens to content published in between 5.0 and 5.0.x? Will content need to be updated to correct? It was suggested that fixing the insertion of full size images in content and incorrect width attributes would let us ship and then iterate. Insertion is already fixed, so it’s just the second one!
    • Q: What would need to be fixed or added to content to allow it to be fixed post-release? Ensure we have correct default height and width attributes on inserted img elements.
    • We started running low on time, but additional clarifications were offered in #core-media. Additional discussion can take place on https://github.com/WordPress/gutenberg/issues/6177
  • There were a number of questions that got interjected during the discussion, that I’ve collected the best I could below.
    • Are we proceeding with the January slip date as identified in the launch post?
      • A January date was seconded by the docs team and a collection of others.
      • Many mentioned concerns around predictability and user trust.
      • Data is still being gathered about how RC1 is being received, and once enough is available, a Core P2 post will be made to help people plan. RC2 is next on the horizon.
      • How much time will there be between the announcement of the release date and the actual release date?
    • Are there any dev notes that need to be posted prior to release? And if so, is there a list? And how can we help?
    • Should we prep a 4.9.9 in order to be prepared for PHP7.3 support?
    • There were multiple offers to help gather necessary data to determine how close we are to a release date.

Component and Focus Updates

  • The PHP team shared last week’s meeting recap which included some discussion of Tide, whether to expose PHP compat on plugins/themes, and best ways to identify those with compatibility concerns. https://make.wordpress.org/core/2018/11/26/php-meeting-recap-november-19th/
  • The JavaScript team shared this week’s meeting recap which included discussion of Contributor Day at WordCamp US, work on docs parsing for devhub, and ESLint configurations. https://make.wordpress.org/core/2018/11/27/javascript-chat-summary-november-27-2018/
  • Design has a new research channel in the works. A lot of their initial work will be around user research for Phase 2+ of Gutenberg. Not much going on, but worth knowing about for sure. 🙂 https://make.wordpress.org/design/2018/11/19/two-ways-to-get-involved-in-gutenberg-user-research/

Next meeting

The next meeting will take place on Wednesday, December 5 21:00 UTC in the #core Slack channel. Please feel free to drop in with any updates or questions. If you have items to discuss but cannot make the meeting, please leave a comment on the upcoming agenda post so that we can take them into account.

#5-0#a11y#core#core-editor#core-js#core-media#core-php#core-restapi#dev-chat#gutenberg#summary#team-reps