Changeset 31039
- Timestamp:
- 01/03/2015 09:31:23 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/media-views.js
r30872 r31039 5431 5431 */ 5432 5432 imageSize: function( size ) { 5433 var sizes = this.model.get('sizes') ;5433 var sizes = this.model.get('sizes'), matched = false; 5434 5434 5435 5435 size = size || 'medium'; 5436 5436 5437 5437 // Use the provided image size if possible. 5438 if ( sizes && sizes[ size ] ) { 5439 return _.clone( sizes[ size ] ); 5440 } else { 5441 return { 5442 url: this.model.get('url'), 5443 width: this.model.get('width'), 5444 height: this.model.get('height'), 5445 orientation: this.model.get('orientation') 5446 }; 5447 } 5438 if ( sizes ) { 5439 if ( sizes[ size ] ) { 5440 matched = sizes[ size ]; 5441 } else if ( sizes.large ) { 5442 matched = sizes.large; 5443 } else if ( sizes.thumbnail ) { 5444 matched = sizes.thumbnail; 5445 } else if ( sizes.full ) { 5446 matched = sizes.full; 5447 } 5448 5449 if ( matched ) { 5450 return _.clone( matched ); 5451 } 5452 } 5453 5454 return { 5455 url: this.model.get('url'), 5456 width: this.model.get('width'), 5457 height: this.model.get('height'), 5458 orientation: this.model.get('orientation') 5459 }; 5448 5460 }, 5449 5461 /**
Note: See TracChangeset
for help on using the changeset viewer.