WordPress 4.7 is less than a fortnight away and the development team is fully focused on making it even more user-friendly. Two major changes to the Media Component have been made along with other complementary changes.
Joe McGill from the WordPress 4.7 Development Team announced few changes to the media component. There are two major changes:
Enhanced PDF Support
WordPress 4.7 has made it easier to preview PDFs in the media library by generating image representations of the first page, which are now used throughout the media library and media attachment screens.
If a WP_Image_Editor that supports PDF is available, the following sizes are generated:
- Full size representation, rendered at 128dpi.
- Thumbnail (without cropping)
- Medium
- Large
The generated sizes are modifiable, or the feature can also be disabled entirely via the new fallback_intermediate_image_sizes filter. The sizes are all stored in the sizes array in attachment meta. The preview images generated are used within the Media screen, Gallery, Attachment Details, and on the Attachment page for PDFs. You can find more details on this topic here.
Improving Accessibility of Image Alternative Text
A new change to the way image alt attribute values are generated has been included in WordPress 4.7. Previously, any time WordPress would attempt to use either the caption text or the image title—in that order—as a fallback value for an image with an empty alt value. The fallback behavior has been removed in WordPress 4.7. So now, users should make sure they set a value for alt text in the media library.
This improves in accessibility as a person using a screenreader would have the alternative text read to them. And ensuring a meaningful alternative text is added to each image makes sure they aren’t confused with unnecessary image titles or captions used as a fallback value. Read more details about the changes here.
In addition, there are few other changes to the media component in WordPress 4.7:
Make Media Library Searchable by File Name
Earlier on, files uploaded to the media library with changed titles weren’t possible to find again by searching for the file name. There have been fixes and now, the attachment search queries will also include matches to the wp_attached_file post meta value.
Other Enhancements and Bug Fixes
- A $wp_error parameter to wp_insert_attachment has been added
- Fix Drag/Drop Ordering of Media in Chrome on touch enabled devices
- Avoid undefined offset notice in wp_prepare_attachment_for_js when image_downsize filter is used
- Improve docs for image_send_to_editor filter
- Use wp_get_attachment_metadata instead of get_post_meta where appropriate
- Ensure wp_get_attachment_link output text for non-images
- Avoid undefined index notices when pathinfo is used
- Improve alignment of inputs and button heights in media edit screens
- Set focus when closing the media modal
The development team is making all necessary changes to WordPress 4.7 to make it more accessible and user-friendly. The WordPress Beta 4 has been available for testing for a week and the Release Candidate is due for release soon.
What do you feel about the changes to the media component in WordPress 4.7? Share it in the comments.