Skip to content

Commit

Permalink
Media: Implement fallback to full-size thumbnails for PDFs in Media L…
Browse files Browse the repository at this point in the history
…ibrary.

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.


git-svn-id: https://develop.svn.wordpress.org/trunk@58947 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
antpb committed Aug 28, 2024
1 parent 3e21d18 commit c544498
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/wp-includes/media-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,12 @@ function wp_print_media_templates() {
<div class="centered">
<# if ( data.image && data.image.src && data.image.src !== data.icon ) { #>
<img src="{{ data.image.src }}" class="thumbnail" draggable="false" alt="" />
<# } else if ( data.sizes && data.sizes.medium ) { #>
<img src="{{ data.sizes.medium.url }}" class="thumbnail" draggable="false" alt="" />
<# } else if ( data.sizes ) {
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 { #>
<img src="{{ data.icon }}" class="icon" draggable="false" alt="" />
<# } #>
Expand Down

0 comments on commit c544498

Please sign in to comment.