Ticket #21785: 21785.suggested-dimensions.5.diff
File 21785.suggested-dimensions.5.diff, 4.3 KB (added by , 11 years ago) |
---|
-
wp-admin/js/customize-controls.js
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 427 title: l10n.chooseImage, 434 428 library: { … … 439 433 close: false 440 434 }, 441 435 multiple: false, 442 imgSelectOptions: this.calculateImageSelectOptions 436 crop: { 437 suggestedWidth: _wpCustomizeHeader.data.width, 438 suggestedHeight: _wpCustomizeHeader.data.height, 439 imgSelectOptions: this.calculateImageSelectOptions 440 } 443 441 }); 444 442 445 443 this.frame.states.add([new wp.media.controller.Cropper()]); -
wp-includes/css/media-views.css
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 /** -
wp-includes/js/media-views.js
3312 3312 }) ); 3313 3313 } 3314 3314 }, 3315 3316 prepare: function() { 3317 var cropOptions = this.controller.options.crop; 3318 if ( cropOptions ) { 3319 return { 3320 suggestedWidth: cropOptions.suggestedWidth, 3321 suggestedHeight: cropOptions.suggestedHeight 3322 } 3323 } 3324 }, 3315 3325 /** 3316 3326 * @returns {wp.media.view.UploaderInline} Returns itself to allow chaining 3317 3327 */ … … 5152 5162 }, 5153 5163 5154 5164 createToolbar: function() { 5155 var filters, FiltersConstructor; 5165 var filters, FiltersConstructor, 5166 frameOptions = this.controller.options; 5156 5167 5157 5168 /** 5158 5169 * @member {wp.media.view.Toolbar} … … 5196 5207 priority: -40 5197 5208 }) ); 5198 5209 } 5210 5211 if ( frameOptions.crop ) { 5212 this.toolbar.set( 'suggestedDimensions', new media.View({ 5213 el: $( '<div class="instructions">' + l10n.suggestedDimensions + frameOptions.crop.suggestedWidth + ' × ' + frameOptions.crop.suggestedHeight + '</div>' )[0], 5214 priority: -40 5215 }) ); 5216 } 5199 5217 }, 5200 5218 5201 5219 updateContent: function() { … … 6228 6246 }; 6229 6247 }, 6230 6248 onImageLoad: function() { 6231 var imgOptions = this.controller.frame.options. imgSelectOptions;6249 var imgOptions = this.controller.frame.options.crop.imgSelectOptions; 6232 6250 if (typeof imgOptions === 'function') { 6233 6251 imgOptions = imgOptions(this.options.attachment, this.controller); 6234 6252 } -
wp-includes/media-template.php
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' ); ?> -
wp-includes/media.php
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