Make WordPress Core

Changeset 49012


Ignore:
Timestamp:
09/20/2020 01:13:46 PM (4 years ago)
Author:
johnbillion
Message:

Media: Correct the image thumbnail logic in media templates.

This ensures the correct data properties are checked before displaying image thumbnails.

Props chetan200891

Fixes #49655

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

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

    r48618 r49012  
    537537                <# if ( data.uploading ) { #>
    538538                    <div class="media-progress-bar"><div style="width: {{ data.percent }}%"></div></div>
    539                 <# } else if ( 'image' === data.type && data.sizes ) { #>
     539                <# } else if ( 'image' === data.type && data.size && data.size.url ) { #>
    540540                    <div class="centered">
    541541                        <img src="{{ data.size.url }}" draggable="false" alt="" />
     
    599599                <# if ( data.uploading ) { #>
    600600                    <div class="media-progress-bar"><div></div></div>
    601                 <# } else if ( 'image' === data.type && data.sizes ) { #>
     601                <# } else if ( 'image' === data.type && data.size && data.size.url ) { #>
    602602                    <img src="{{ data.size.url }}" draggable="false" alt="" />
    603603                <# } else { #>
  • trunk/src/wp-includes/media.php

    r48905 r49012  
    24072407    ?>
    24082408<script type="text/html" id="tmpl-wp-playlist-current-item">
    2409     <# if ( data.image ) { #>
    2410     <img src="{{ data.thumb.src }}" alt="" />
     2409    <# if ( data.thumb && data.thumb.src ) { #>
     2410        <img src="{{ data.thumb.src }}" alt="" />
    24112411    <# } #>
    24122412    <div class="wp-playlist-caption">
Note: See TracChangeset for help on using the changeset viewer.