Ticket #11325: 11325.diff
| File 11325.diff, 2.0 KB (added by , 15 years ago) |
|---|
-
wp-admin/js/image-edit.dev.js
1 1 var imageEdit; 2 var imageEdit; 2 3 3 4 (function($) { 4 5 imageEdit = { … … 343 344 }, 344 345 345 346 setCropSelection : function(postid, c) { 346 var sel, min = $('#imgedit-minthumb-' + postid).val() || '128:128', 347 sizer = this.hold['sizer']; 348 min = min.split(':'); 349 c = c || 0; 347 var sel; 348 349 c = c || 0; 350 350 351 351 if ( !c || ( c.width < 3 && c.height < 3 ) ) { 352 352 this.setDisabled($('.imgedit-crop', '#imgedit-panel-' + postid), 0); … … 357 357 return false; 358 358 } 359 359 360 if ( c.width < (min[0] * sizer) && c.height < (min[1] * sizer) ) {361 this.setDisabled($('.imgedit-crop', '#imgedit-panel-' + postid), 0);362 $('#imgedit-selection-' + postid).val('');363 return false;364 }365 366 360 sel = { 'x': c.x1, 'y': c.y1, 'w': c.width, 'h': c.height }; 367 361 this.setDisabled($('.imgedit-crop', '#imgedit-panel-' + postid), 1); 368 362 $('#imgedit-selection-' + postid).val( JSON.stringify(sel) ); … … 433 427 crop : function (postid, nonce, t) { 434 428 var sel = $('#imgedit-selection-' + postid).val(), 435 429 w = this.intval( $('#imgedit-sel-width-' + postid).val() ), 436 h = this.intval( $('#imgedit-sel-height-' + postid).val() ); 430 h = this.intval( $('#imgedit-sel-height-' + postid).val() ), 431 min = $('#imgedit-minthumb-' + postid).val() || '128:128', 432 sizer = this.hold.sizer, 433 434 min = min.split(':'); 437 435 438 436 if ( $(t).hasClass('disabled') || sel == '' ) 439 437 return false; 440 438 441 439 sel = JSON.parse(sel); 440 if( sel.w < ( min[0] * sizer ) && sel.h < ( min[1] * sizer ) ) { 441 alert( 'The area you have selected for cropping is smaller than the default thumbnail size (' + min.join(':') + '). Please select a larger area.' ); 442 return false; 443 } 444 442 445 if ( sel.w > 0 && sel.h > 0 && w > 0 && h > 0 ) { 443 446 sel['fw'] = w; 444 447 sel['fh'] = h;