WordPress.org

Make WordPress Core

Opened 4 months ago

Last modified 3 months 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 (4)

49852.patch (400 bytes) - added by samful 4 months ago.
samful's patch for video thumbnails not appearing on list view
49852.2.patch (854 bytes) - added by samful 4 months ago.
samful's patch for video and audio thumbnails not appearing on list view
49852.3.patch (852 bytes) - added by samful 4 months ago.
fixed a silly mistake where i left the array in quotes…
49852.4.patch (962 bytes) - added by samful 6 weeks ago.
refreshed with proper /src path and line numbers

Download all attachments as: .zip

Change History (9)

@samful
4 months ago

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

#1 @samful
4 months 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 4 months ago by samful (previous) (diff)

#2 @johnbillion
4 months 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
4 months ago

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

#3 @samful
4 months 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 4 months ago by samful (previous) (diff)

@samful
4 months ago

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

#4 @JavierCasares
3 months ago

  • Keywords has-screenshots added

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

vs

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

#5 @JavierCasares
3 months ago

Also, works great :)

@samful
6 weeks ago

refreshed with proper /src path and line numbers

Note: See TracTickets for help on using tickets.