WordPress.org

Make WordPress Core

Opened 19 months ago

Last modified 14 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 (5)

49852.patch (400 bytes) - added by samful 18 months ago.
samful's patch for video thumbnails not appearing on list view
49852.2.patch (854 bytes) - added by samful 18 months ago.
samful's patch for video and audio thumbnails not appearing on list view
49852.3.patch (852 bytes) - added by samful 18 months ago.
fixed a silly mistake where i left the array in quotes…
49852.4.patch (962 bytes) - added by samful 16 months ago.
refreshed with proper /src path and line numbers
49852.5.diff (907 bytes) - added by seanchayes 14 months ago.
Updated spacing matching coding standards - no functional changes

Download all attachments as: .zip

Change History (11)

@samful
18 months ago

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

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

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

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

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

@samful
18 months ago

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

#4 @JavierCasares
17 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
17 months ago

Also, works great :)

@samful
16 months ago

refreshed with proper /src path and line numbers

#6 @seanchayes
14 months ago

I downloaded 49852.4.patch and applied it to my local trunk installation.

To test it out I did the following:

  • I added a new video file to the media library.
  • In the media library list view the video I uploaded showed a default thumbnail.
  • I edited the media item and chose a featured image and clicked update.
  • I returned to the media library list view and saw that now my featured image selection was being used as the thumbnail for my video file.
  • I successfully repeated the same test with an audio file.

To that end 49852.4.patch tested out successfully.

I iterated on 49852.4.patch, made some coding standards changes (no functional changes) and have submitted 49852.5.diff for consideration.

@seanchayes
14 months ago

Updated spacing matching coding standards - no functional changes

Note: See TracTickets for help on using tickets.