Media: Implement fallback to full-size thumbnails for PDFs in Media Library.

When medium-size thumbnails are disabled, PDF previews in the Media Library grid view now fall back to displaying full-size thumbnails instead of a generic document icon.

Props daleharrison, kushang78, mukesh27, sudipatel007, mai21, antpb.
Fixes #39630.

Built from https://develop.svn.wordpress.org/trunk@58947


git-svn-id: http://core.svn.wordpress.org/trunk@58343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
antpb 2024-08-28 17:01:13 +00:00
parent e57bee933a
commit 81cfe7488c
2 changed files with 7 additions and 3 deletions

View File

@ -605,8 +605,12 @@ function wp_print_media_templates() {
<div class="centered"> <div class="centered">
<# if ( data.image && data.image.src && data.image.src !== data.icon ) { #> <# if ( data.image && data.image.src && data.image.src !== data.icon ) { #>
<img src="{{ data.image.src }}" class="thumbnail" draggable="false" alt="" /> <img src="{{ data.image.src }}" class="thumbnail" draggable="false" alt="" />
<# } else if ( data.sizes && data.sizes.medium ) { #> <# } else if ( data.sizes ) {
<img src="{{ data.sizes.medium.url }}" class="thumbnail" draggable="false" alt="" /> if ( data.sizes.medium ) { #>
<img src="{{ data.sizes.medium.url }}" class="thumbnail" draggable="false" alt="" />
<# } else { #>
<img src="{{ data.sizes.full.url }}" class="thumbnail" draggable="false" alt="" />
<# } #>
<# } else { #> <# } else { #>
<img src="{{ data.icon }}" class="icon" draggable="false" alt="" /> <img src="{{ data.icon }}" class="icon" draggable="false" alt="" />
<# } #> <# } #>

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.7-alpha-58946'; $wp_version = '6.7-alpha-58947';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.