mirror of
git://develop.git.wordpress.org/
synced 2025-02-26 17:42:26 +01:00
Gallery Views: Avoid JS errors when image attachments lack metadata.
props gcorne. fixes #27691. git-svn-id: https://develop.svn.wordpress.org/trunk@28008 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c765ed8832
commit
5404d9933f
@ -289,10 +289,12 @@ window.wp = window.wp || {};
|
||||
attachments = this.attachments.toJSON();
|
||||
|
||||
_.each( attachments, function( attachment ) {
|
||||
if ( attachment.sizes.thumbnail ) {
|
||||
attachment.thumbnail = attachment.sizes.thumbnail;
|
||||
} else {
|
||||
attachment.thumbnail = attachment.sizes.full;
|
||||
if ( attachment.sizes ) {
|
||||
if ( attachment.sizes.thumbnail ) {
|
||||
attachment.thumbnail = attachment.sizes.thumbnail;
|
||||
} else if ( attachment.sizes.full ) {
|
||||
attachment.thumbnail = attachment.sizes.full;
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
@ -975,7 +975,11 @@ function wp_print_media_templates() {
|
||||
<# _.each( data.attachments, function( attachment, index ) { #>
|
||||
<dl class="gallery-item">
|
||||
<dt class="gallery-icon">
|
||||
<img src="{{{ attachment.thumbnail.url }}}" width="{{ attachment.thumbnail.width }}" height="{{ attachment.thumbnail.height }}" />
|
||||
<# if ( attachment.thumbnail ) { #>
|
||||
<img src="{{ attachment.thumbnail.url }}" width="{{ attachment.thumbnail.width }}" height="{{ attachment.thumbnail.height }}" />
|
||||
<# } else { #>
|
||||
<img src="{{ attachment.url }}" />
|
||||
<# } #>
|
||||
</dt>
|
||||
<dd class="wp-caption-text gallery-caption">
|
||||
{{ attachment.caption }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user