Changeset 13544
- Timestamp:
- Mar 13, 2012, 10:13:17 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/batch_manager_global.php
r13457 r13544 412 412 } 413 413 414 if ('regenerateThumbnails' == $action) 414 if ('delete_derivatives' == $action) 415 { 416 $query='SELECT path,representative_ext FROM '.IMAGES_TABLE.' 417 WHERE id IN ('.implode(',', $collection).')'; 418 $result = pwg_query($query); 419 while ($info = pwg_db_fetch_assoc($result)) 420 { 421 foreach( $_POST['del_derivatives_type'] as $type) 422 { 423 delete_element_derivatives($info, $type); 424 } 425 } 426 } 427 428 if ('generate_derivatives' == $action) 415 429 { 416 430 if ($_POST['regenerateSuccess'] != '0') 417 array_push($page['infos'], sprintf(l10n('%s thumbnails have been regenerated'), $_POST['regenerateSuccess']));431 array_push($page['infos'], sprintf(l10n('%s photos were generated'), $_POST['regenerateSuccess'])); 418 432 419 433 if ($_POST['regenerateError'] != '0') 420 array_push($page['warnings'], sprintf(l10n('%s thumbnails can not be regenerated'), $_POST['regenerateError'])); 421 422 $update_fields = array('thumb_maxwidth', 'thumb_maxheight', 'thumb_quality', 'thumb_crop', 'thumb_follow_orientation'); 423 } 424 425 if ('regenerateWebsize' == $action) 426 { 427 if ($_POST['regenerateSuccess'] != '0') 428 array_push($page['infos'], sprintf(l10n('%s photos have been regenerated'), $_POST['regenerateSuccess'])); 429 430 if ($_POST['regenerateError'] != '0') 431 array_push($page['warnings'], sprintf(l10n('%s photos can not be regenerated'), $_POST['regenerateError'])); 432 433 $update_fields = array('websize_maxwidth', 'websize_maxheight', 'websize_quality'); 434 } 435 436 if (!empty($update_fields)) 437 { 438 // Update upload configuration 439 $updates = array(); 440 foreach ($update_fields as $field) 441 { 442 $value = !empty($_POST[$field]) ? $_POST[$field] : null; 443 $form_values[$field] = $value; 444 $updates[$field] = $value; 445 } 446 save_upload_form_config($updates); 434 array_push($page['warnings'], sprintf(l10n('%s photos were not generated'), $_POST['regenerateError'])); 435 447 436 } 448 437 … … 673 662 ); 674 663 664 //derivatives 665 $del_deriv_map = array(); 666 foreach(ImageStdParams::get_defined_type_map() as $params) 667 { 668 $del_deriv_map[$params->type] = l10n($params->type); 669 } 670 $template->assign( 671 array( 672 'del_derivatives_types' => $del_deriv_map, 673 'generate_derivatives_types' => $del_deriv_map, 674 ) 675 ); 676 675 677 // +-----------------------------------------------------------------------+ 676 678 // | global mode thumbnails | … … 757 759 { 758 760 $nb_thumbs_page++; 759 $src = DerivativeImage::thumb_url($row);761 $src_image = new SrcImage($row); 760 762 761 763 $title = render_element_name($row); … … 769 771 array( 770 772 'ID' => $row['id'], 771 'TN_SRC' => $src,773 'TN_SRC' => DerivativeImage::url(IMG_THUMB, $src_image), 772 774 'FILE' => $row['file'], 773 775 'TITLE' => $title, 774 776 'LEVEL' => $row['level'], 775 'FILE_SRC' => $row['path'],777 'FILE_SRC' => DerivativeImage::url(IMG_LARGE, $src_image), 776 778 'U_EDIT' => get_root_url().'admin.php?page=photo-'.$row['id'], 777 779 ) -
trunk/admin/themes/default/template/batch_manager_global.tpl
r13066 r13544 95 95 var nb_thumbs_set = {$nb_thumbs_set}; 96 96 var applyOnDetails_pattern = "{'on the %d selected photos'|@translate}"; 97 var elements = new Array();97 var elements = []; 98 98 var all_elements = [{if !empty($all_elements)}{','|@implode:$all_elements}{/if}]; 99 var generate_derivatives_done=false; 99 100 100 101 var selectedMessage_pattern = "{'%d of %d photos selected'|@translate}"; 101 102 var selectedMessage_none = "{'No photo selected, %d photos in current set'|@translate}"; 102 103 var selectedMessage_all = "{'All %d photos are selected'|@translate}"; 103 var regenerateThumbnailsMessage = "{'Thumbnails generation in progress...'|@translate}";104 var regenerateWebsizeMessage = "{'Photos generation in progress...'|@translate}";105 104 106 105 var width_str = '{'Width'|@translate}'; … … 163 162 barImage: 'themes/default/images/progressbg_orange.gif' 164 163 }); 165 type = success ? 'regenerateSuccess': 'regenerateError' 166 s = jQuery('[name="'+type+'"]').val(); 167 jQuery('[name="'+type+'"]').val(++s); 168 169 if (val == max) 170 jQuery('#applyAction').click(); 164 if (success !== undefined) { 165 var type = success ? 'regenerateSuccess': 'regenerateError', 166 s = jQuery('[name="'+type+'"]').val(); 167 jQuery('[name="'+type+'"]').val(++s); 168 } 169 170 if (val == max) { 171 generate_derivatives_done = true; 172 jQuery('#applyAction').click(); 173 } 171 174 } 172 175 … … 403 406 404 407 jQuery('#applyAction').click(function() { 405 if (elements.length != 0) 406 { 407 return true; 408 } 409 else if (jQuery('[name="selectAction"]').val() == 'regenerateThumbnails') 410 { 411 resizeMethod = 'pwg.images.resizeThumbnail'; 412 maxRequests = 3; 413 maxwidth = jQuery('input[name="thumb_maxwidth"]').val(); 414 maxheight = jQuery('input[name="thumb_maxheight"]').val(); 415 regenerationText = regenerateThumbnailsMessage; 416 crop = jQuery('input[name="thumb_crop"]').is(':checked'); 417 follow_orientation = jQuery('input[name="thumb_follow_orientation"]').is(':checked'); 418 } 419 else if(jQuery('[name="selectAction"]').val() == 'regenerateWebsize') 420 { 421 resizeMethod = 'pwg.images.resizeWebsize'; 422 maxRequests = 1; 423 maxwidth = jQuery('input[name="websize_maxwidth"]').val(); 424 maxheight = jQuery('input[name="websize_maxheight"]').val(); 425 regenerationText = regenerateWebsizeMessage; 426 crop = false; 427 follow_orientation = false; 428 } 429 else return true; 430 431 jQuery('.bulkAction').hide(); 432 jQuery('#regenerationText').html(regenerationText); 433 434 var queuedManager = jQuery.manageAjax.create('queued', { 435 queue: true, 436 cacheResponse: false, 437 maxRequests: maxRequests 438 }); 439 440 if (jQuery('input[name="setSelected"]').attr('checked')) 441 elements = all_elements; 442 else 443 jQuery('input[name="selection[]"]').each(function() { 444 if (jQuery(this).attr('checked')) { 445 elements.push(jQuery(this).val()); 446 } 447 }); 448 449 progressBar_max = elements.length; 450 todo = 0; 451 452 jQuery('#applyActionBlock').hide(); 453 jQuery('select[name="selectAction"]').hide(); 454 jQuery('#regenerationMsg').show(); 455 456 jQuery('#progressBar').progressBar(0, { 457 max: progressBar_max, 458 textFormat: 'fraction', 459 boxImage: 'themes/default/images/progressbar.gif', 460 barImage: 'themes/default/images/progressbg_orange.gif' 461 }); 462 463 for (i=0;i<elements.length;i++) { 464 queuedManager.add({ 465 type: 'GET', 466 url: 'ws.php', 467 data: { 468 method: resizeMethod, 469 maxwidth: maxwidth, 470 maxheight: maxheight, 471 crop: crop, 472 follow_orientation: follow_orientation, 473 image_id: elements[i], 474 format: 'json' 475 }, 476 dataType: 'json', 477 success: ( function(data) { progress(++todo, progressBar_max, data['result']) }), 478 error: ( function(data) { progress(++todo, progressBar_max, false) }) 479 }); 480 } 481 return false; 482 }); 483 484 function toggleCropFields(prefix) { 485 if (jQuery("#"+prefix+"_crop").is(':checked')) { 486 jQuery("#"+prefix+"_width_th").text(width_str); 487 jQuery("#"+prefix+"_height_th").text(height_str); 488 jQuery("#"+prefix+"_follow_orientation_tr").show(); 489 } 490 else { 491 jQuery("#"+prefix+"_width_th").text(max_width_str); 492 jQuery("#"+prefix+"_height_th").text(max_height_str); 493 jQuery("#"+prefix+"_follow_orientation_tr").hide(); 494 } 495 } 496 497 toggleCropFields("thumb"); 498 jQuery("#thumb_crop").click(function () {toggleCropFields("thumb")}); 408 if (jQuery('[name="selectAction"]').val() != 'generate_derivatives') 409 { 410 return true; 411 } 412 if (generate_derivatives_done) 413 { 414 return true; 415 } 416 417 jQuery('.bulkAction').hide(); 418 419 var queuedManager = jQuery.manageAjax.create('queued', { 420 queue: true, 421 cacheResponse: false, 422 maxRequests: 1 423 }); 424 425 if (jQuery('input[name="setSelected"]').attr('checked')) 426 elements = all_elements; 427 else 428 jQuery('input[name="selection[]"]').each(function() { 429 if (jQuery(this).attr('checked')) { 430 elements.push(jQuery(this).val()); 431 } 432 }); 433 434 progressBar_max = 0; 435 todo = 0; 436 437 jQuery('#applyActionBlock').hide(); 438 jQuery('select[name="selectAction"]').hide(); 439 jQuery('#regenerationMsg').show(); 440 441 jQuery('#progressBar').progressBar(0, { 442 max: progressBar_max, 443 textFormat: 'fraction', 444 boxImage: 'themes/default/images/progressbar.gif', 445 barImage: 'themes/default/images/progressbg_orange.gif' 446 }); 447 448 getDerivativeUrls(); 449 return false; 450 }); 451 452 function getDerivativeUrls() { 453 if (elements.length==0) 454 return; 455 var ids = elements.splice(0, 500); 456 var params = {max_urls: 100000, ids: ids, types: []}; 457 jQuery("#action_generate_derivatives input").each( function(i, t) { 458 if ($(t).attr("checked")) 459 params.types.push( t.value ); 460 } ); 461 462 jQuery.ajax( { 463 type: "POST", 464 url: 'ws.php?format=json&method=pwg.getMissingDerivatives', 465 data: params, 466 dataType: "json", 467 success: function(data) { 468 if (!data.stat || data.stat != "ok") { 469 return; 470 } 471 progressBar_max += data.result.urls.length; 472 progress(todo, progressBar_max); 473 for (var i=0; i < data.result.urls.length; i++) { 474 jQuery.manageAjax.add("queued", { 475 type: 'GET', 476 url: data.result.urls[i] + "&ajaxload=true", 477 dataType: 'json', 478 success: ( function(data) { progress(++todo, progressBar_max, true) }), 479 error: ( function(data) { progress(++todo, progressBar_max, false) }) 480 }); 481 } 482 } 483 } ); 484 } 499 485 500 486 checkPermitAction() … … 502 488 503 489 jQuery(window).load(function() { 504 var max_dim = 0; 505 $(".thumbnails img").each(function () { 506 max_dim = Math.max(max_dim, $(this).height(), $(this).width() ); 507 }); 508 max_dim += 35; 509 $("ul.thumbnails span, ul.thumbnails label").css('width', max_dim+'px').css('height', max_dim+'px'); 510 $('ul.thumbnails').enableShiftClick(); 490 var max_w=0, max_h=0; 491 $(".thumbnails img").each(function () { 492 max_w = Math.max(max_w, $(this).width() ); 493 max_h = Math.max(max_h, $(this).height() ); 494 }); 495 max_w += 10; 496 max_h += 35; 497 $("ul.thumbnails span, ul.thumbnails label").css('width', max_w+'px').css('height', max_h+'px'); 498 $('ul.thumbnails').enableShiftClick(); 511 499 }); 512 500 {/literal}{/footer_script} … … 604 592 605 593 <ul class="thumbnails"> 606 {foreach from=$thumbnails item=thumbnail} 607 {if in_array($thumbnail.ID, $selection)} 608 {assign var='isSelected' value=true} 609 {else} 610 {assign var='isSelected' value=false} 611 {/if} 612 613 <li> 614 <span class="wrap1"> 615 <label> 616 <span class="wrap2{if $isSelected} thumbSelected{/if}"> 617 <div class="actions"><a href="{$thumbnail.FILE_SRC}" class="preview-box">{'Zoom'|@translate}</a> · <a href="{$thumbnail.U_EDIT}" target="_blank">{'Edit'|@translate}</a></div> 618 {if $thumbnail.LEVEL > 0} 619 <em class="levelIndicatorB">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.LEVEL))}</em> 620 <em class="levelIndicatorF" title="{'Who can see these photos?'|@translate} : ">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.LEVEL))}</em> 621 {/if} 622 <span> 623 <img src="{$thumbnail.TN_SRC}" 624 alt="{$thumbnail.FILE}" 625 title="{$thumbnail.TITLE|@escape:'html'}" 626 class="thumbnail"> 627 </span> 628 </span> 629 <input type="checkbox" name="selection[]" value="{$thumbnail.ID}" {if $isSelected}checked="checked"{/if}> 630 </label> 631 </span> 632 </li> 594 {foreach from=$thumbnails item=thumbnail} 595 {if in_array($thumbnail.ID, $selection)} 596 {assign var='isSelected' value=true} 597 {else} 598 {assign var='isSelected' value=false} 599 {/if} 600 <li> 601 <span class="wrap1"> 602 <label> 603 <span class="wrap2{if $isSelected} thumbSelected{/if}"> 604 <div class="actions"><a href="{$thumbnail.FILE_SRC}" class="preview-box">{'Zoom'|@translate}</a> · <a href="{$thumbnail.U_EDIT}" target="_blank">{'Edit'|@translate}</a></div> 605 {if $thumbnail.LEVEL > 0} 606 <em class="levelIndicatorB">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.LEVEL))}</em> 607 <em class="levelIndicatorF" title="{'Who can see these photos?'|@translate} : ">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.LEVEL))}</em> 608 {/if} 609 <span> 610 <img src="{$thumbnail.TN_SRC}" alt="{$thumbnail.FILE}" title="{$thumbnail.TITLE|@escape:'html'}" class="thumbnail"> 611 </span> 612 </span> 613 <input type="checkbox" name="selection[]" value="{$thumbnail.ID}" {if $isSelected}checked="checked"{/if}> 614 </label> 615 </span> 616 </li> 633 617 {/foreach} 634 618 </ul> … … 687 671 <option value="add_to_caddie">{'Add to caddie'|@translate}</option> 688 672 {/if} 689 <option value="regenerateThumbnails">{'Regenerate Thumbnails'|@translate}</option>690 <option value="regenerateWebsize">{'Regenerate Websize Photos'|@translate}</option>673 <option value="delete_derivatives">{'Delete multiple size images'|@translate}</option> 674 <option value="generate_derivatives">{'Generate multiple size images'|@translate}</option> 691 675 {if !empty($element_set_global_plugins_actions)} 692 676 {foreach from=$element_set_global_plugins_actions item=action} … … 785 769 </div> 786 770 787 <!-- regenerate thumbnails --> 788 <div id="action_regenerateThumbnails" class="bulkAction"> 789 <table style="margin-left:20px;"> 790 <tr> 791 <th><label for="thumb_crop">{'Crop'|@translate}</label></th> 792 <td><input type="checkbox" name="thumb_crop" id="thumb_crop" {if $upload_form_settings.thumb_crop}checked="checked"{/if}></td> 793 </tr> 794 <tr id="thumb_follow_orientation_tr"> 795 <th><label for="thumb_follow_orientation">{'Follow Orientation'|@translate}</label></th> 796 <td><input type="checkbox" name="thumb_follow_orientation" id="thumb_follow_orientation" {if $upload_form_settings.thumb_follow_orientation}checked="checked"{/if}></td> 797 </tr> 798 <tr> 799 <th id="thumb_width_th">{'Maximum Width'|@translate}</th> 800 <td><input type="text" name="thumb_maxwidth" value="{$upload_form_settings.thumb_maxwidth}" size="4" maxlength="4"> {'pixels'|@translate}</td> 801 </tr> 802 <tr> 803 <th id="thumb_height_th">{'Maximum Height'|@translate}</th> 804 <td><input type="text" name="thumb_maxheight" value="{$upload_form_settings.thumb_maxheight}" size="4" maxlength="4"> {'pixels'|@translate}</td> 805 </tr> 806 <tr> 807 <th>{'Image Quality'|@translate}</th> 808 <td><input type="text" name="thumb_quality" value="{$upload_form_settings.thumb_quality}" size="3" maxlength="3"> %</td> 809 </tr> 810 </table> 811 </div> 812 813 <!-- regenerate websize --> 814 <div id="action_regenerateWebsize" class="bulkAction"> 815 <p> 816 <img src="admin/themes/default/icon/warning.png" alt="!" style="vertical-align:middle;"> 817 {'By default, Piwigo will create a new websize from the HD (high definition) version of your photo.'|@translate} 818 {'If no HD is available and if the current websize is bigger than resize dimensions, Piwigo will move it as HD and create a downsized websize photo from it.'|@translate} 819 </p> 820 821 <table style="margin:10px 20px;"> 822 <tr> 823 <th>{'Maximum Width'|@translate}</th> 824 <td><input type="text" name="websize_maxwidth" value="{$upload_form_settings.websize_maxwidth}" size="4" maxlength="4"> {'pixels'|@translate}</td> 825 </tr> 826 <tr> 827 <th>{'Maximum Height'|@translate}</th> 828 <td><input type="text" name="websize_maxheight" value="{$upload_form_settings.websize_maxheight}" size="4" maxlength="4"> {'pixels'|@translate}</td> 829 </tr> 830 <tr> 831 <th>{'Image Quality'|@translate}</th> 832 <td><input type="text" name="websize_quality" value="{$upload_form_settings.websize_quality}" size="3" maxlength="3"> %</td> 833 </tr> 834 </table> 835 </div> 836 771 <!-- generate derivatives --> 772 <div id="action_generate_derivatives" class="bulkAction"> 773 <a href="javascript:selectGenerateDerivAll()">{'All'|@translate}</a>, 774 <a href="javascript:selectGenerateDerivNone()">{'None'|@translate}</a> 775 <br> 776 {foreach from=$generate_derivatives_types key=type item=disp} 777 <label><input type="checkbox" name="generate_derivatives_type[]" value="{$type}"> {$disp}</label> 778 {/foreach} 779 {footer_script} 780 function selectGenerateDerivAll() {ldelim} 781 $("#action_generate_derivatives input[type=checkbox]").attr("checked", true); 782 } 783 function selectGenerateDerivNone() {ldelim} 784 $("#action_generate_derivatives input[type=checkbox]").attr("checked", false); 785 } 786 {/footer_script} 787 </div> 788 789 <!-- delete derivatives --> 790 <div id="action_delete_derivatives" class="bulkAction"> 791 <a href="javascript:selectDelDerivAll()">{'All'|@translate}</a>, 792 <a href="javascript:selectDelDerivNone()">{'None'|@translate}</a> 793 <br> 794 {foreach from=$del_derivatives_types key=type item=disp} 795 <label><input type="checkbox" name="del_derivatives_type[]" value="{$type}"> {$disp}</label> 796 {/foreach} 797 {footer_script} 798 function selectDelDerivAll() {ldelim} 799 $("#action_delete_derivatives input[type=checkbox]").attr("checked", true); 800 } 801 function selectDelDerivNone() {ldelim} 802 $("#action_delete_derivatives input[type=checkbox]").attr("checked", false); 803 } 804 {/footer_script} 805 </div> 806 837 807 <!-- progress bar --> 838 <div id="regenerationMsg" class="bulkAction" >839 <p id="regenerationText" style="margin-bottom:10px;"> </p>808 <div id="regenerationMsg" class="bulkAction" style="display:none"> 809 <p id="regenerationText" style="margin-bottom:10px;">{'Generate multiple size images'|@translate}</p> 840 810 <span class="progressBar" id="progressBar"></span> 841 811 <input type="hidden" name="regenerateSuccess" value="0"> -
trunk/admin/themes/default/template/maintenance.tpl
r13074 r13544 35 35 <li><a href="{$U_MAINT_SEARCH}"onclick="return confirm('{'Purge search history'|@translate|@escape:'javascript'}');">{'Purge search history'|@translate}</a></li> 36 36 <li><a href="{$U_MAINT_COMPILED_TEMPLATES}">{'Purge compiled templates'|@translate}</a></li> 37 <li>{' Purge derivative image cache'|@translate}:37 <li>{'Delete multiple size images'|@translate}: 38 38 {foreach from=$purge_derivatives key=name item=url name=loop}{if !$smarty.foreach.loop.first}, {/if}<a href="{$url}">{$name}</a>{/foreach} 39 39 </li> -
trunk/include/ws_functions.inc.php
r13090 r13544 220 220 $where_clauses = ws_std_image_sql_filter( $params, '' ); 221 221 $where_clauses[] = 'id<start_id'; 222 if ( !empty($params['ids']) ) 223 { 224 $where_clauses[] = 'id IN ('.implode(',',$params['ids']).')'; 225 } 222 226 223 227 $query_model = 'SELECT id, path, representative_ext, width, height … … 3267 3271 } 3268 3272 3269 function ws_images_resizethumbnail($params, &$service)3270 {3271 if (!is_admin())3272 {3273 return new PwgError(401, 'Access denied');3274 }3275 3276 if (empty($params['image_id']) and empty($params['image_path']))3277 {3278 return new PwgError(403, "image_id or image_path is missing");3279 }3280 3281 include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');3282 include_once(PHPWG_ROOT_PATH.'admin/include/image.class.php');3283 3284 if (!empty($params['image_id']))3285 {3286 $query='3287 SELECT id, path, tn_ext, has_high3288 FROM '.IMAGES_TABLE.'3289 WHERE id = '.(int)$params['image_id'].'3290 ;';3291 $image = pwg_db_fetch_assoc(pwg_query($query));3292 3293 if ($image == null)3294 {3295 return new PwgError(403, "image_id not found");3296 }3297 3298 $image_path = $image['path'];3299 $thumb_path = get_thumbnail_path($image);3300 }3301 else3302 {3303 $image_path = $params['image_path'];3304 $thumb_path = file_path_for_type($image_path, 'thumb');3305 }3306 3307 if (!file_exists($image_path) or !is_valid_image_extension(get_extension($image_path)))3308 {3309 return new PwgError(403, "image can't be resized");3310 }3311 3312 $result = false;3313 prepare_directory(dirname($thumb_path));3314 $img = new pwg_image($image_path, $params['library']);3315 3316 if (!is_bool($params['crop']))3317 $params['crop'] = get_boolean($params['crop']);3318 if (!is_bool($params['follow_orientation']))3319 $params['follow_orientation'] = get_boolean($params['follow_orientation']);3320 3321 $result = $img->pwg_resize(3322 $thumb_path,3323 $params['maxwidth'],3324 $params['maxheight'],3325 $params['quality'],3326 false, // automatic rotation is not needed for thumbnails.3327 true, // strip metadata3328 $params['crop'],3329 $params['follow_orientation']3330 );3331 3332 $img->destroy();3333 return $result;3334 }3335 3336 function ws_images_resizewebsize($params, &$service)3337 {3338 if (!is_admin())3339 {3340 return new PwgError(401, 'Access denied');3341 }3342 3343 include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');3344 include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');3345 include_once(PHPWG_ROOT_PATH.'admin/include/image.class.php');3346 3347 $query='3348 SELECT id, path, tn_ext, has_high, width, height3349 FROM '.IMAGES_TABLE.'3350 WHERE id = '.(int)$params['image_id'].'3351 ;';3352 $image = pwg_db_fetch_assoc(pwg_query($query));3353 3354 if ($image == null)3355 {3356 return new PwgError(403, "image_id not found");3357 }3358 3359 $image_path = $image['path'];3360 3361 if (!is_valid_image_extension(get_extension($image_path)))3362 {3363 return new PwgError(403, "image can't be resized");3364 }3365 3366 $hd_path = get_high_path($image);3367 3368 if (empty($image['has_high']) or !file_exists($hd_path))3369 {3370 if ($image['width'] > $params['maxwidth'] or $image['height'] > $params['maxheight'])3371 {3372 $hd_path = file_path_for_type($image_path, 'high');3373 $hd_dir = dirname($hd_path);3374 prepare_directory($hd_dir);3375 3376 rename($image_path, $hd_path);3377 $hd_infos = pwg_image_infos($hd_path);3378 3379 single_update(3380 IMAGES_TABLE,3381 array(3382 'has_high' => 'true',3383 'high_filesize' => $hd_infos['filesize'],3384 'high_width' => $hd_infos['width'],3385 'high_height' => $hd_infos['height'],3386 ),3387 array(3388 'id' => $image['id']3389 )3390 );3391 }3392 else3393 {3394 return new PwgError(403, "image can't be resized");3395 }3396 }3397 3398 $result = false;3399 $img = new pwg_image($hd_path, $params['library']);3400 3401 $result = $img->pwg_resize(3402 $image_path,3403 $params['maxwidth'],3404 $params['maxheight'],3405 $params['quality'],3406 $params['automatic_rotation'],3407 false // strip metadata3408 );3409 3410 $img->destroy();3411 3412 global $conf;3413 $conf['use_exif'] = false;3414 $conf['use_iptc'] = false;3415 sync_metadata(array($image['id']));3416 3417 return $result;3418 }3419 3420 3273 function ws_extensions_update($params, &$service) 3421 3274 { -
trunk/language/en_UK/admin.lang.php
r13543 r13544 79 79 $lang['%s photos can not be regenerated'] = '%s photos can not be regenerated'; 80 80 $lang['%s photos have been regenerated'] = '%s photos have been regenerated'; 81 $lang['%s thumbnails can not be regenerated'] = '%s thumbnails can not be regenerated';82 $lang['%s thumbnails have been regenerated'] = '%s thumbnails have been regenerated';83 81 $lang['%s value is not correct file because exif are not supported'] = "%s value is incorrect because exif are not supported"; 84 82 $lang['(this tag will be deleted)'] = '(this tag will be deleted)'; … … 573 571 $lang['Refresh photo set'] = 'Refresh photo set'; 574 572 $lang['Refresh'] = "Refresh"; 575 $lang['Regenerate Thumbnails'] = 'Regenerate Thumbnails';576 $lang['Regenerate Websize Photos'] = 'Regenerate Websize Photos';577 573 $lang['registration date'] = "registration date"; 578 574 $lang['Reinitialize check integrity'] = "Reinitialize integrity check"; … … 867 863 $lang['ReGalAndroid (RemoteGallery client for Android) is an open source (GPL v3) Piwigo client for the Android platform.'] = 'ReGalAndroid (RemoteGallery client for Android) is an open source (GPL v3) Piwigo client for the Android platform.'; 868 864 $lang['Features include gallery browsing, album creation and photo upload.'] = 'Features include gallery browsing, album creation and photo upload.'; 865 $lang['Generate multiple size images']='Generate multiple size images'; 866 $lang['Delete multiple size images']='Delete multiple size images'; 869 867 ?> -
trunk/ws.php
r13090 r13544 90 90 array( 91 91 'types' => array( 'default'=>array(), 'flags'=>WS_PARAM_FORCE_ARRAY), 92 'ids' => array( 'default'=>array(), 'flags'=>WS_PARAM_FORCE_ARRAY), 92 93 'max_urls' => array( 'default' => 200 ), 93 94 'prev_page' => array( 'default'=> null), … … 458 459 'activate/deactivate/delete/set_default a theme<br>administration status required' 459 460 ); 460 461 $service->addMethod(462 'pwg.images.resizeThumbnail',463 'ws_images_resizethumbnail',464 array(465 'image_id' => array('default' => null),466 'image_path' => array('default' => null),467 'maxwidth' => array('default' => $conf['upload_form_thumb_maxwidth']),468 'maxheight' => array('default' => $conf['upload_form_thumb_maxheight']),469 'quality' => array('default' => $conf['upload_form_thumb_quality']),470 'crop' => array('default' => $conf['upload_form_thumb_crop']),471 'follow_orientation' => array('default' => $conf['upload_form_thumb_follow_orientation']),472 'library' => array('default' => $conf['graphics_library']),473 ),474 'Create/Regenerate thumbnails photo with given arguments.475 <br>One of arguments "image_id" or "image_path" must be sent.'476 );477 478 $service->addMethod(479 'pwg.images.resizeWebsize',480 'ws_images_resizewebsize',481 array(482 'image_id' => array(),483 'maxwidth' => array('default' => $conf['upload_form_websize_maxwidth']),484 'maxheight' => array('default' => $conf['upload_form_websize_maxheight']),485 'quality' => array('default' => $conf['upload_form_websize_quality']),486 'automatic_rotation' => array('default' => $conf['upload_form_automatic_rotation']),487 'library' => array('default' => $conf['graphics_library']),488 ),489 'Regenerate websize photo with given arguments.'490 );491 461 492 462 $service->addMethod(
Note: See TracChangeset
for help on using the changeset viewer.