mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-09 19:50:05 +00:00
In Media Grid, don't immediately load full size images if the requested size passed to wp.media.view.Attachment.imageSize() does not exist, look for other suitable sizes.
Fixes #30861. git-svn-id: https://develop.svn.wordpress.org/trunk@31039 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -5430,21 +5430,33 @@
|
||||
* @returns {Object}
|
||||
*/
|
||||
imageSize: function( size ) {
|
||||
var sizes = this.model.get('sizes');
|
||||
var sizes = this.model.get('sizes'), matched = false;
|
||||
|
||||
size = size || 'medium';
|
||||
|
||||
// Use the provided image size if possible.
|
||||
if ( sizes && sizes[ size ] ) {
|
||||
return _.clone( sizes[ size ] );
|
||||
} else {
|
||||
return {
|
||||
url: this.model.get('url'),
|
||||
width: this.model.get('width'),
|
||||
height: this.model.get('height'),
|
||||
orientation: this.model.get('orientation')
|
||||
};
|
||||
if ( sizes ) {
|
||||
if ( sizes[ size ] ) {
|
||||
matched = sizes[ size ];
|
||||
} else if ( sizes.large ) {
|
||||
matched = sizes.large;
|
||||
} else if ( sizes.thumbnail ) {
|
||||
matched = sizes.thumbnail;
|
||||
} else if ( sizes.full ) {
|
||||
matched = sizes.full;
|
||||
}
|
||||
|
||||
if ( matched ) {
|
||||
return _.clone( matched );
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
url: this.model.get('url'),
|
||||
width: this.model.get('width'),
|
||||
height: this.model.get('height'),
|
||||
orientation: this.model.get('orientation')
|
||||
};
|
||||
},
|
||||
/**
|
||||
* @param {Object} event
|
||||
|
||||
Reference in New Issue
Block a user