Make WordPress Core

Ticket #26959: 26959-no-thumbnail-01.patch

File 26959-no-thumbnail-01.patch, 2.3 KB (added by gcorne, 11 years ago)
  • src/wp-includes/js/mce-view.js

    diff --git src/wp-includes/js/mce-view.js src/wp-includes/js/mce-view.js
    index 0881680..7d5f051 100644
    window.wp = window.wp || {}; 
    268268
    269269                        getHtml: function() {
    270270                                var attrs = this.shortcode.attrs.named,
    271                                         options;
     271                                        options,
     272                                        attachments;
    272273
    273274                                if ( ! this.attachments.length ) {
    274275                                        return;
    275276                                }
    276277
     278                                attachments = this.attachments.toJSON();
     279
     280                                _.each( attachments, function( attachment ) {
     281                                        if ( attachment.sizes.thumbnail ) {
     282                                                attachment.thumbnail = attachment.sizes.thumbnail;
     283                                        } else {
     284                                                attachment.thumbnail = attachment.sizes.full;
     285                                        }
     286                                } );
     287
    277288                                options = {
    278                                         attachments: this.attachments.toJSON(),
     289                                        attachments: attachments,
    279290                                        columns: attrs.columns ? parseInt( attrs.columns, 10 ) : 3
    280291                                };
    281292
  • src/wp-includes/media-template.php

    diff --git src/wp-includes/media-template.php src/wp-includes/media-template.php
    index 345935a..946e506 100644
    function wp_print_media_templates() { 
    897897                        </div>
    898898                </div>
    899899        </script>
    900         <?php
    901 
    902                 //TODO: do we want to deal with the fact that the elements used for gallery items are filterable and can be overriden via shortcode attributes
    903                 // do we want to deal with the difference between display and edit context at all? (e.g. wptexturize() being applied to the caption.
    904         ?>
    905 
    906900        <script type="text/html" id="tmpl-editor-gallery">
    907901                <div class="toolbar">
    908902                        <div class="dashicons dashicons-edit edit"></div>
    function wp_print_media_templates() { 
    912906                        <# _.each( data.attachments, function( attachment, index ) { #>
    913907                                <dl class="gallery-item">
    914908                                        <dt class="gallery-icon">
    915                                                 <?php // TODO: need to figure out the best way to make sure that we have thumbnails ?>
    916                                                 <img src="{{{ attachment.sizes.thumbnail.url }}}" />
     909                                                <img src="{{{ attachment.thumbnail.url }}}" width="{{ attachment.thumbnail.width }}" height="{{ attachment.thumbnail.height }}" />
    917910                                        </dt>
    918911                                        <dd class="wp-caption-text gallery-caption">
    919912                                                {{ attachment.caption }}
    920913                                        </dd>
    921914                                </dl>
    922                                 <?php // this is kind silly, but copied from the gallery shortcode. Maybe it should be removed ?>
    923915                                <# if ( index % data.columns === data.columns - 1 ) { #>
    924916                                        <br style="clear: both;">
    925917                                <# } #>