- Timestamp:
- Apr 22, 2011, 12:35:16 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/batch_manager_global.php
r10454 r10553 418 418 array_push($page['warnings'], sprintf(l10n('%s thumbnails can not be regenerated'), $_POST['regenerateError'])); 419 419 420 $update_fields = array('thumb_maxwidth', 'thumb_maxheight', 'thumb_quality' );420 $update_fields = array('thumb_maxwidth', 'thumb_maxheight', 'thumb_quality', 'thumb_crop', 'thumb_follow_orientation'); 421 421 } 422 422 … … 438 438 foreach ($update_fields as $field) 439 439 { 440 $value = null; 441 if (!empty($_POST[$field])) 440 if (is_bool($upload_form_config[$field]['default'])) 442 441 { 443 $value = $_POST[$field]; 444 } 445 446 if (preg_match($upload_form_config[$field]['pattern'], $value) 447 and $value >= $upload_form_config[$field]['min'] 448 and $value <= $upload_form_config[$field]['max']) 449 { 450 $conf['upload_form_'.$field] = $value; 451 $updates[] = array( 442 $value = isset($_POST[$field]); 443 444 $updates[] = array( 452 445 'param' => 'upload_form_'.$field, 453 'value' => $value446 'value' => boolean_to_string($value) 454 447 ); 455 448 } 456 449 else 457 450 { 458 $updates = null; 459 break; 451 $value = null; 452 if (!empty($_POST[$field])) 453 { 454 $value = $_POST[$field]; 455 } 456 457 if (preg_match($upload_form_config[$field]['pattern'], $value) 458 and $value >= $upload_form_config[$field]['min'] 459 and $value <= $upload_form_config[$field]['max']) 460 { 461 $conf['upload_form_'.$field] = $value; 462 $updates[] = array( 463 'param' => 'upload_form_'.$field, 464 'value' => $value 465 ); 466 } 467 else 468 { 469 $updates = null; 470 break; 471 } 460 472 } 461 473 $form_values[$field] = $value; -
trunk/admin/themes/default/template/batch_manager_global.tpl
r10454 r10553 37 37 var regenerateThumbnailsMessage = "{'Thumbnails generation in progress...'|@translate}"; 38 38 var regenerateWebsizeMessage = "{'Photos generation in progress...'|@translate}"; 39 40 var width_str = '{'Width'|@translate}'; 41 var height_str = '{'Height'|@translate}'; 42 var max_width_str = '{'Maximum Width'|@translate}'; 43 var max_height_str = '{'Maximum Height'|@translate}'; 39 44 {literal} 40 45 function str_repeat(i, m) { … … 334 339 maxheight = jQuery('input[name="thumb_maxheight"]').val(); 335 340 regenerationText = regenerateThumbnailsMessage; 341 crop = jQuery('input[name="thumb_crop"]').is(':checked'); 342 follow_orientation = jQuery('input[name="thumb_follow_orientation"]').is(':checked'); 336 343 } 337 344 else if(jQuery('[name="selectAction"]').val() == 'regenerateWebsize') … … 342 349 maxheight = jQuery('input[name="websize_maxheight"]').val(); 343 350 regenerationText = regenerateWebsizeMessage; 351 crop = false; 352 follow_orientation = false; 344 353 } 345 354 else return true; … … 386 395 maxwidth: maxwidth, 387 396 maxheight: maxheight, 397 crop: crop, 398 follow_orientation: follow_orientation, 388 399 image_id: elements[i], 389 400 format: 'json' … … 396 407 return false; 397 408 }); 409 410 function toggleCropFields(prefix) { 411 if (jQuery("#"+prefix+"_crop").is(':checked')) { 412 jQuery("#"+prefix+"_width_th").text(width_str); 413 jQuery("#"+prefix+"_height_th").text(height_str); 414 jQuery("#"+prefix+"_follow_orientation_tr").show(); 415 } 416 else { 417 jQuery("#"+prefix+"_width_th").text(max_width_str); 418 jQuery("#"+prefix+"_height_th").text(max_height_str); 419 jQuery("#"+prefix+"_follow_orientation_tr").hide(); 420 } 421 } 422 423 toggleCropFields("thumb"); 424 jQuery("#thumb_crop").click(function () {toggleCropFields("thumb")}); 398 425 399 426 checkPermitAction() … … 662 689 <table style="margin-left:20px;"> 663 690 <tr> 664 <th>{'Maximum Width'|@translate}</th> 691 <th><label for="thumb_crop">{'Crop'|@translate}</label></th> 692 <td><input type="checkbox" name="thumb_crop" id="thumb_crop" {if $upload_form_settings.thumb_crop}checked="checked"{/if}></td> 693 </tr> 694 <tr id="thumb_follow_orientation_tr"> 695 <th><label for="thumb_follow_orientation">{'Follow Orientation'|@translate}</label></th> 696 <td><input type="checkbox" name="thumb_follow_orientation" id="thumb_follow_orientation" {if $upload_form_settings.thumb_follow_orientation}checked="checked"{/if}></td> 697 </tr> 698 <tr> 699 <th id="thumb_width_th">{'Maximum Width'|@translate}</th> 665 700 <td><input type="text" name="thumb_maxwidth" value="{$upload_form_settings.thumb_maxwidth}" size="4" maxlength="4"> {'pixels'|@translate}</td> 666 701 </tr> 667 702 <tr> 668 <th >{'Maximum Height'|@translate}</th>703 <th id="thumb_height_th">{'Maximum Height'|@translate}</th> 669 704 <td><input type="text" name="thumb_maxheight" value="{$upload_form_settings.thumb_maxheight}" size="4" maxlength="4"> {'pixels'|@translate}</td> 670 705 </tr> -
trunk/include/ws_functions.inc.php
r10538 r10553 2674 2674 } 2675 2675 2676 $resize_params = array('maxwidth', 'maxheight', 'quality' );2676 $resize_params = array('maxwidth', 'maxheight', 'quality', 'crop', 'follow_orientation'); 2677 2677 $type = $params['type'] == 'thumbnail' ? 'thumb' : 'websize'; 2678 2678 foreach ($resize_params as $param) 2679 2679 { 2680 if (empty($params[$param]) )2680 if (empty($params[$param]) and isset($conf['upload_form_'.$type.'_'.$param])) 2681 2681 $params[$param] = $conf['upload_form_'.$type.'_'.$param]; 2682 2682 } … … 2711 2711 $params['maxheight'], 2712 2712 $params['quality'], 2713 true 2713 true, 2714 get_boolean($params['crop']), 2715 get_boolean($params['follow_orientation']) 2714 2716 ); 2715 2717 return true; -
trunk/ws.php
r10538 r10553 413 413 'maxwidth' => array('default' => null), 414 414 'maxheight' => array('default' => null), 415 'crop' => array('default' => null), 416 'follow_orientation' => array('default' => null), 415 417 'quality' => array('default' => null), 416 418 ), 417 419 'Regenerate thumbnails or websize photo with given arguments. 418 420 <br>Argument "type" can be "thumbnail" or "websize". Default is "thumbnail". 419 <br>If maxwidth, maxheight or quality are missing, default parameters of upload will be used.'421 <br>If maxwidth, maxheight, crop, follow_orientation or quality are missing, default parameters of upload will be used.' 420 422 ); 421 423
Note: See TracChangeset
for help on using the changeset viewer.