WordPress.org

Make WordPress Core

Opened 7 weeks ago

Last modified 10 days ago

#49852 new enhancement

Use feature image of video attachment as preview instead of icon

Reported by: spacedmonkey Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Media Keywords: good-first-bug needs-refresh has-patch has-screenshots
Focuses: Cc:

Description

In the media library list view, it currently shows a video icon. A user is able to selected featured image for video attachments ( used for poster image in video tag ). If a feature image is set for a video attachment, show this instead of the icon.

Attachments (3)

49852.patch (400 bytes) - added by samful 5 weeks ago.
samful's patch for video thumbnails not appearing on list view
49852.2.patch (854 bytes) - added by samful 5 weeks ago.
samful's patch for video and audio thumbnails not appearing on list view
49852.3.patch (852 bytes) - added by samful 5 weeks ago.
fixed a silly mistake where i left the array in quotes…

Download all attachments as: .zip

Change History (8)

@samful
5 weeks ago

samful's patch for video thumbnails not appearing on list view

#1 @samful
5 weeks ago

I managed to replicate this and fix it in the "wp-admin/includes/class-wp-media-list-table.php" file and submitted a patch.

Using my patch seems to use the featured image of the video (if set) instead of the icon in list view and solve the issue.

This is my first bug fix, I hope it helps :)

Last edited 5 weeks ago by samful (previous) (diff)

#2 @johnbillion
5 weeks ago

  • Keywords needs-refresh has-patch added; needs-patch removed

Thanks for the patch @samful and welcome to WordPress Trac!

Some feedback on your patch, as it's your first one:

  • It looks like the formatting of your patch file isn't right, here's a guide for creating a patch file correctly: https://make.wordpress.org/core/handbook/tutorials/trac/submitting-a-patch/
  • Not all videos will have a featured image, so we'll need some logic which only uses the featured image ID if one exists, and still uses the ID of the video attachment if not so the correct icon is displayed.
  • Audio files can actually have a featured image too, although this is not a commonly used feature. They're used if you create an audio playlist in the classic editor. We might as well add support for featured images for audio too.

Feel free to resubmit your patch using the same file name, and just ask here if you have any questions.

@samful
5 weeks ago

samful's patch for video and audio thumbnails not appearing on list view

#3 @samful
5 weeks ago

Thank you for the feedback @johnbillion, very much appreciated.

  • Formatting should be correct now.
  • Logic has been added to keep using the video/audio ID if a featured image doesn't exist.
  • Audio featured images have now been fixed in the same style as the video ones.
Last edited 5 weeks ago by samful (previous) (diff)

@samful
5 weeks ago

fixed a silly mistake where i left the array in quotes...

#4 @JavierCasares
10 days ago

  • Keywords has-screenshots added

https://i.ibb.co/xz58YqG/Screenshot-240.png

vs

https://i.ibb.co/sgC9BpR/Screenshot-239.png

#5 @JavierCasares
10 days ago

Also, works great :)

Note: See TracTickets for help on using tickets.