diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
index 39edc8b..88e020c 100644
|
|
|
389 | 389 | keys: true, |
390 | 390 | instance: true, |
391 | 391 | persistent: true, |
392 | | parent: this.$el, |
393 | 392 | imageWidth: realWidth, |
394 | 393 | imageHeight: realHeight, |
395 | 394 | x1: 0, |
diff --git src/wp-includes/css/media-views.css src/wp-includes/css/media-views.css
index cccf307..34687a8 100644
|
|
|
608 | 608 | margin-right: 20px; |
609 | 609 | } |
610 | 610 | |
611 | | .media-frame-content .crop-content { |
| 611 | .media-frame-content .crop-content .crop-image { |
612 | 612 | display: block; |
613 | 613 | margin: auto; |
614 | 614 | max-width: 100%; |
615 | 615 | max-height: 100%; |
616 | 616 | } |
617 | 617 | |
| 618 | .media-frame-content .crop-content .upload-errors |
| 619 | { |
| 620 | position: absolute; |
| 621 | width: 300px; |
| 622 | top: 50%; |
| 623 | left: 50%; |
| 624 | margin-left: -150px; |
| 625 | margin-right: -150px; |
| 626 | z-index: 600000; |
| 627 | } |
| 628 | |
618 | 629 | /** |
619 | 630 | * Iframes |
620 | 631 | */ |
diff --git src/wp-includes/js/media-views.js src/wp-includes/js/media-views.js
index 80db8d2..a979343 100644
|
|
|
1344 | 1344 | this.controller.state().doCrop( selection ).done( function( croppedImage ) { |
1345 | 1345 | self.controller.trigger('cropped', croppedImage ); |
1346 | 1346 | self.controller.close(); |
| 1347 | }).fail( function() { |
| 1348 | self.controller.trigger('content:error:crop'); |
1347 | 1349 | }); |
1348 | 1350 | } |
1349 | 1351 | } |
… |
… |
|
6163 | 6165 | * @augments Backbone.View |
6164 | 6166 | */ |
6165 | 6167 | media.view.Cropper = media.View.extend({ |
6166 | | tagName: 'img', |
6167 | 6168 | className: 'crop-content', |
| 6169 | template: media.template('crop-content'), |
6168 | 6170 | initialize: function() { |
6169 | 6171 | _.bindAll(this, 'onImageLoad'); |
6170 | | this.$el.attr('src', this.options.attachment.get('url')); |
6171 | 6172 | }, |
6172 | 6173 | ready: function() { |
6173 | | this.$el.on('load', this.onImageLoad); |
| 6174 | this.controller.frame.on('content:error:crop', this.onError, this); |
| 6175 | this.$image = this.$el.find('.crop-image'); |
| 6176 | this.$image.on('load', this.onImageLoad); |
6174 | 6177 | $(window).on('resize.cropper', _.debounce(this.onImageLoad, 250)); |
6175 | 6178 | }, |
6176 | 6179 | remove: function() { |
… |
… |
|
6190 | 6193 | if (typeof imgOptions === 'function') { |
6191 | 6194 | imgOptions = imgOptions(this.options.attachment, this.controller); |
6192 | 6195 | } |
| 6196 | |
| 6197 | imgOptions = _.extend(imgOptions, {parent: this.$el}); |
6193 | 6198 | this.trigger('image-loaded'); |
6194 | | this.controller.imgSelect = this.$el.imgAreaSelect(imgOptions); |
6195 | | } |
| 6199 | this.controller.imgSelect = this.$image.imgAreaSelect(imgOptions); |
| 6200 | }, |
| 6201 | onError: function() { |
| 6202 | var filename = this.options.attachment.get('filename'); |
6196 | 6203 | |
| 6204 | this.views.add( '.upload-errors', new media.view.UploaderStatusError({ |
| 6205 | filename: media.view.UploaderStatus.prototype.filename(filename), |
| 6206 | message: _wpMediaViewsL10n.cropError |
| 6207 | }), { at: 0 }); |
| 6208 | } |
6197 | 6209 | }); |
6198 | 6210 | |
6199 | 6211 | media.view.EditImage = media.View.extend({ |
diff --git src/wp-includes/media-template.php src/wp-includes/media-template.php
index 76e595c..c85a3e3 100644
|
|
function wp_print_media_templates() { |
1034 | 1034 | <div class="wpview-overlay"></div> |
1035 | 1035 | </script> |
1036 | 1036 | |
| 1037 | <script type="text/html" id="tmpl-crop-content"> |
| 1038 | <img class="crop-image" src="{{ data.url }}"> |
| 1039 | <div class="upload-errors"></div> |
| 1040 | </script> |
| 1041 | |
1037 | 1042 | <?php |
1038 | 1043 | |
1039 | 1044 | /** |
diff --git src/wp-includes/media.php src/wp-includes/media.php
index ad2e7e6..64bf81d 100644
|
|
function wp_enqueue_media( $args = array() ) { |
2528 | 2528 | 'cropping' => __( 'Cropping…' ), |
2529 | 2529 | 'suggestedWidth' => __( 'Suggested width is %d pixels.' ), |
2530 | 2530 | 'suggestedHeight' => __( 'Suggested height is %d pixels.' ), |
| 2531 | 'cropError' => __( 'There has been an error cropping your image.' ), |
2531 | 2532 | |
2532 | 2533 | // Edit Audio |
2533 | 2534 | 'audioDetailsTitle' => __( 'Audio Details' ), |