Make WordPress Core

Changeset 58947


Ignore:
Timestamp:
08/28/2024 04:59:07 PM (5 weeks ago)
Author:
antpb
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media-template.php

    r58927 r58947  
    606606                        <# if ( data.image && data.image.src && data.image.src !== data.icon ) { #>
    607607                            <img src="{{ data.image.src }}" class="thumbnail" draggable="false" alt="" />
    608                         <# } else if ( data.sizes && data.sizes.medium ) { #>
    609                             <img src="{{ data.sizes.medium.url }}" class="thumbnail" draggable="false" alt="" />
     608                        <# } else if ( data.sizes ) {
     609                                if ( data.sizes.medium ) { #>
     610                                    <img src="{{ data.sizes.medium.url }}" class="thumbnail" draggable="false" alt="" />
     611                                <# } else { #>
     612                                    <img src="{{ data.sizes.full.url }}" class="thumbnail" draggable="false" alt="" />
     613                                <# } #>
    610614                        <# } else { #>
    611615                            <img src="{{ data.icon }}" class="icon" draggable="false" alt="" />
Note: See TracChangeset for help on using the changeset viewer.