diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
index 88e020c..8cc4130 100644
|
|
|
|
| 419 | 419 | * @param {event} event |
| 420 | 420 | */ |
| 421 | 421 | openMedia: function(event) { |
| 422 | | var suggestedWidth, suggestedHeight, |
| 423 | | l10n = _wpMediaViewsL10n; |
| | 422 | var l10n = _wpMediaViewsL10n; |
| 424 | 423 | |
| 425 | 424 | event.preventDefault(); |
| 426 | 425 | |
| 427 | | suggestedWidth = l10n.suggestedWidth.replace('%d', _wpCustomizeHeader.data.width); |
| 428 | | suggestedHeight = l10n.suggestedHeight.replace('%d', _wpCustomizeHeader.data.height); |
| 429 | | |
| 430 | | /* '<span class="suggested-dimensions">' + suggestedWidth + ' ' + suggestedHeight + '</span>' */ |
| 431 | | |
| 432 | 426 | this.frame = wp.media({ |
| 433 | | title: l10n.chooseImage, |
| 434 | | library: { |
| 435 | | type: 'image' |
| 436 | | }, |
| 437 | 427 | button: { |
| 438 | 428 | text: l10n.selectAndCrop, |
| 439 | 429 | close: false |
| 440 | 430 | }, |
| 441 | | multiple: false, |
| 442 | | imgSelectOptions: this.calculateImageSelectOptions |
| | 431 | states: [ |
| | 432 | new wp.media.controller.Library({ |
| | 433 | title: l10n.chooseImage, |
| | 434 | library: wp.media.query({ type: 'image' }), |
| | 435 | multiple: false, |
| | 436 | priority: 20, |
| | 437 | suggestedWidth: _wpCustomizeHeader.data.width, |
| | 438 | suggestedHeight: _wpCustomizeHeader.data.height |
| | 439 | }), |
| | 440 | new wp.media.controller.Cropper({ |
| | 441 | imgSelectOptions: this.calculateImageSelectOptions |
| | 442 | }) |
| | 443 | ] |
| 443 | 444 | }); |
| 444 | 445 | |
| 445 | | this.frame.states.add([new wp.media.controller.Cropper()]); |
| 446 | | |
| 447 | 446 | this.frame.on('select', this.onSelect, this); |
| 448 | 447 | this.frame.on('cropped', this.onCropped, this); |
| 449 | 448 | this.frame.on('skippedcrop', this.onSkippedCrop, this); |
diff --git src/wp-includes/css/media-views.css src/wp-includes/css/media-views.css
index 2e172b1..c339723 100644
|
|
|
|
| 929 | 929 | line-height: 18px; |
| 930 | 930 | font-size: 13px; |
| 931 | 931 | color: #666; |
| | 932 | margin-right: 0.5em; |
| 932 | 933 | } |
| 933 | 934 | |
| 934 | 935 | /** |
diff --git src/wp-includes/js/media-views.js src/wp-includes/js/media-views.js
index 97dd232..2838ffe 100644
|
|
|
|
| 1843 | 1843 | display: state.get('displaySettings'), |
| 1844 | 1844 | dragInfo: state.get('dragInfo'), |
| 1845 | 1845 | |
| | 1846 | suggestedWidth: state.get('suggestedWidth'), |
| | 1847 | suggestedHeight: state.get('suggestedHeight'), |
| | 1848 | |
| 1846 | 1849 | AttachmentView: state.get('AttachmentView') |
| 1847 | 1850 | }); |
| 1848 | 1851 | }, |
| … |
… |
|
| 3312 | 3315 | }) ); |
| 3313 | 3316 | } |
| 3314 | 3317 | }, |
| | 3318 | |
| | 3319 | prepare: function() { |
| | 3320 | var suggestedWidth = this.controller.state().get('suggestedWidth'), |
| | 3321 | suggestedHeight = this.controller.state().get('suggestedHeight'); |
| | 3322 | |
| | 3323 | if ( suggestedWidth && suggestedHeight ) { |
| | 3324 | return { |
| | 3325 | suggestedWidth: suggestedWidth, |
| | 3326 | suggestedHeight: suggestedHeight |
| | 3327 | }; |
| | 3328 | } |
| | 3329 | }, |
| 3315 | 3330 | /** |
| 3316 | 3331 | * @returns {wp.media.view.UploaderInline} Returns itself to allow chaining |
| 3317 | 3332 | */ |
| … |
… |
|
| 5196 | 5211 | priority: -40 |
| 5197 | 5212 | }) ); |
| 5198 | 5213 | } |
| | 5214 | |
| | 5215 | if ( this.options.suggestedWidth && this.options.suggestedHeight ) { |
| | 5216 | this.toolbar.set( 'suggestedDimensions', new media.View({ |
| | 5217 | el: $( '<div class="instructions">' + l10n.suggestedDimensions + ' ' + this.options.suggestedWidth + ' × ' + this.options.suggestedHeight + '</div>' )[0], |
| | 5218 | priority: -40 |
| | 5219 | }) ); |
| | 5220 | } |
| 5199 | 5221 | }, |
| 5200 | 5222 | |
| 5201 | 5223 | updateContent: function() { |
| … |
… |
|
| 6228 | 6250 | }; |
| 6229 | 6251 | }, |
| 6230 | 6252 | onImageLoad: function() { |
| 6231 | | var imgOptions = this.controller.frame.options.imgSelectOptions; |
| | 6253 | var imgOptions = this.controller.get('imgSelectOptions'); |
| 6232 | 6254 | if (typeof imgOptions === 'function') { |
| 6233 | 6255 | imgOptions = imgOptions(this.options.attachment, this.controller); |
| 6234 | 6256 | } |
diff --git src/wp-includes/media-template.php src/wp-includes/media-template.php
index f38638d..3d2f368 100644
|
|
|
function wp_print_media_templates() { |
| 205 | 205 | printf( __( 'Maximum upload file size: %d%s.' ), esc_html($upload_size_unit), esc_html($byte_sizes[$u]) ); |
| 206 | 206 | ?></p> |
| 207 | 207 | |
| | 208 | <# if ( data.suggestedWidth && data.suggestedHeight ) { #> |
| | 209 | <p class="suggested-dimensions"> |
| | 210 | <?php _e( 'Suggested image dimensions:' ); ?> {{{data.suggestedWidth}}} × {{{data.suggestedHeight}}} |
| | 211 | </p> |
| | 212 | <# } #> |
| | 213 | |
| 208 | 214 | <?php |
| 209 | 215 | /** This action is documented in wp-admin/includes/media.php */ |
| 210 | 216 | do_action( 'post-upload-ui' ); ?> |
diff --git src/wp-includes/media.php src/wp-includes/media.php
index adeaed4..f8c5d7e 100644
|
|
|
function wp_enqueue_media( $args = array() ) { |
| 2527 | 2527 | 'cropImage' => __( 'Crop Image' ), |
| 2528 | 2528 | 'cropYourImage' => __( 'Crop your image' ), |
| 2529 | 2529 | 'cropping' => __( 'Cropping…' ), |
| 2530 | | 'suggestedWidth' => __( 'Suggested width is %d pixels.' ), |
| 2531 | | 'suggestedHeight' => __( 'Suggested height is %d pixels.' ), |
| | 2530 | 'suggestedDimensions' => __( 'Suggested image dimensions:' ), |
| 2532 | 2531 | 'cropError' => __( 'There has been an error cropping your image.' ), |
| 2533 | 2532 | |
| 2534 | 2533 | // Edit Audio |