aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--admin/batch_manager_global.php58
-rw-r--r--admin/themes/default/template/batch_manager_global.tpl348
-rw-r--r--admin/themes/default/template/maintenance.tpl2
-rw-r--r--include/ws_functions.inc.php155
-rw-r--r--language/en_UK/admin.lang.php6
-rw-r--r--ws.php32
6 files changed, 197 insertions, 404 deletions
diff --git a/admin/batch_manager_global.php b/admin/batch_manager_global.php
index c2a9fdc53..6242a2dc9 100644
--- a/admin/batch_manager_global.php
+++ b/admin/batch_manager_global.php
@@ -411,39 +411,28 @@ DELETE
);
}
- if ('regenerateThumbnails' == $action)
+ if ('delete_derivatives' == $action)
{
- if ($_POST['regenerateSuccess'] != '0')
- array_push($page['infos'], sprintf(l10n('%s thumbnails have been regenerated'), $_POST['regenerateSuccess']));
-
- if ($_POST['regenerateError'] != '0')
- array_push($page['warnings'], sprintf(l10n('%s thumbnails can not be regenerated'), $_POST['regenerateError']));
-
- $update_fields = array('thumb_maxwidth', 'thumb_maxheight', 'thumb_quality', 'thumb_crop', 'thumb_follow_orientation');
+ $query='SELECT path,representative_ext FROM '.IMAGES_TABLE.'
+ WHERE id IN ('.implode(',', $collection).')';
+ $result = pwg_query($query);
+ while ($info = pwg_db_fetch_assoc($result))
+ {
+ foreach( $_POST['del_derivatives_type'] as $type)
+ {
+ delete_element_derivatives($info, $type);
+ }
+ }
}
- if ('regenerateWebsize' == $action)
+ if ('generate_derivatives' == $action)
{
if ($_POST['regenerateSuccess'] != '0')
- array_push($page['infos'], sprintf(l10n('%s photos have been regenerated'), $_POST['regenerateSuccess']));
+ array_push($page['infos'], sprintf(l10n('%s photos were generated'), $_POST['regenerateSuccess']));
if ($_POST['regenerateError'] != '0')
- array_push($page['warnings'], sprintf(l10n('%s photos can not be regenerated'), $_POST['regenerateError']));
-
- $update_fields = array('websize_maxwidth', 'websize_maxheight', 'websize_quality');
- }
+ array_push($page['warnings'], sprintf(l10n('%s photos were not generated'), $_POST['regenerateError']));
- if (!empty($update_fields))
- {
- // Update upload configuration
- $updates = array();
- foreach ($update_fields as $field)
- {
- $value = !empty($_POST[$field]) ? $_POST[$field] : null;
- $form_values[$field] = $value;
- $updates[$field] = $value;
- }
- save_upload_form_config($updates);
}
trigger_action('element_set_global_action', $action, $collection);
@@ -672,6 +661,19 @@ $template->assign(
)
);
+//derivatives
+$del_deriv_map = array();
+foreach(ImageStdParams::get_defined_type_map() as $params)
+{
+ $del_deriv_map[$params->type] = l10n($params->type);
+}
+$template->assign(
+ array(
+ 'del_derivatives_types' => $del_deriv_map,
+ 'generate_derivatives_types' => $del_deriv_map,
+ )
+ );
+
// +-----------------------------------------------------------------------+
// | global mode thumbnails |
// +-----------------------------------------------------------------------+
@@ -756,7 +758,7 @@ SELECT id,path,representative_ext,file,filesize,level,name
while ($row = pwg_db_fetch_assoc($result))
{
$nb_thumbs_page++;
- $src = DerivativeImage::thumb_url($row);
+ $src_image = new SrcImage($row);
$title = render_element_name($row);
if ($title != get_name_from_file($row['file']))
@@ -768,11 +770,11 @@ SELECT id,path,representative_ext,file,filesize,level,name
'thumbnails',
array(
'ID' => $row['id'],
- 'TN_SRC' => $src,
+ 'TN_SRC' => DerivativeImage::url(IMG_THUMB, $src_image),
'FILE' => $row['file'],
'TITLE' => $title,
'LEVEL' => $row['level'],
- 'FILE_SRC' => $row['path'],
+ 'FILE_SRC' => DerivativeImage::url(IMG_LARGE, $src_image),
'U_EDIT' => get_root_url().'admin.php?page=photo-'.$row['id'],
)
);
diff --git a/admin/themes/default/template/batch_manager_global.tpl b/admin/themes/default/template/batch_manager_global.tpl
index d368591c2..8dfd08cb1 100644
--- a/admin/themes/default/template/batch_manager_global.tpl
+++ b/admin/themes/default/template/batch_manager_global.tpl
@@ -94,14 +94,13 @@ jQuery(document).ready(function() {ldelim}
var nb_thumbs_page = {$nb_thumbs_page};
var nb_thumbs_set = {$nb_thumbs_set};
var applyOnDetails_pattern = "{'on the %d selected photos'|@translate}";
-var elements = new Array();
+var elements = [];
var all_elements = [{if !empty($all_elements)}{','|@implode:$all_elements}{/if}];
+var generate_derivatives_done=false;
var selectedMessage_pattern = "{'%d of %d photos selected'|@translate}";
var selectedMessage_none = "{'No photo selected, %d photos in current set'|@translate}";
var selectedMessage_all = "{'All %d photos are selected'|@translate}";
-var regenerateThumbnailsMessage = "{'Thumbnails generation in progress...'|@translate}";
-var regenerateWebsizeMessage = "{'Photos generation in progress...'|@translate}";
var width_str = '{'Width'|@translate}';
var height_str = '{'Height'|@translate}';
@@ -162,12 +161,16 @@ function progress(val, max, success) {
boxImage: 'themes/default/images/progressbar.gif',
barImage: 'themes/default/images/progressbg_orange.gif'
});
- type = success ? 'regenerateSuccess': 'regenerateError'
- s = jQuery('[name="'+type+'"]').val();
- jQuery('[name="'+type+'"]').val(++s);
-
- if (val == max)
- jQuery('#applyAction').click();
+ if (success !== undefined) {
+ var type = success ? 'regenerateSuccess': 'regenerateError',
+ s = jQuery('[name="'+type+'"]').val();
+ jQuery('[name="'+type+'"]').val(++s);
+ }
+
+ if (val == max) {
+ generate_derivatives_done = true;
+ jQuery('#applyAction').click();
+ }
}
$(document).ready(function() {
@@ -402,112 +405,97 @@ $(document).ready(function() {
});
jQuery('#applyAction').click(function() {
- if (elements.length != 0)
- {
- return true;
- }
- else if (jQuery('[name="selectAction"]').val() == 'regenerateThumbnails')
- {
- resizeMethod = 'pwg.images.resizeThumbnail';
- maxRequests = 3;
- maxwidth = jQuery('input[name="thumb_maxwidth"]').val();
- maxheight = jQuery('input[name="thumb_maxheight"]').val();
- regenerationText = regenerateThumbnailsMessage;
- crop = jQuery('input[name="thumb_crop"]').is(':checked');
- follow_orientation = jQuery('input[name="thumb_follow_orientation"]').is(':checked');
- }
- else if(jQuery('[name="selectAction"]').val() == 'regenerateWebsize')
- {
- resizeMethod = 'pwg.images.resizeWebsize';
- maxRequests = 1;
- maxwidth = jQuery('input[name="websize_maxwidth"]').val();
- maxheight = jQuery('input[name="websize_maxheight"]').val();
- regenerationText = regenerateWebsizeMessage;
- crop = false;
- follow_orientation = false;
- }
- else return true;
-
- jQuery('.bulkAction').hide();
- jQuery('#regenerationText').html(regenerationText);
-
- var queuedManager = jQuery.manageAjax.create('queued', {
- queue: true,
- cacheResponse: false,
- maxRequests: maxRequests
- });
-
- if (jQuery('input[name="setSelected"]').attr('checked'))
- elements = all_elements;
- else
- jQuery('input[name="selection[]"]').each(function() {
- if (jQuery(this).attr('checked')) {
- elements.push(jQuery(this).val());
- }
- });
-
- progressBar_max = elements.length;
- todo = 0;
-
- jQuery('#applyActionBlock').hide();
- jQuery('select[name="selectAction"]').hide();
- jQuery('#regenerationMsg').show();
-
- jQuery('#progressBar').progressBar(0, {
- max: progressBar_max,
- textFormat: 'fraction',
- boxImage: 'themes/default/images/progressbar.gif',
- barImage: 'themes/default/images/progressbg_orange.gif'
- });
-
- for (i=0;i<elements.length;i++) {
- queuedManager.add({
- type: 'GET',
- url: 'ws.php',
- data: {
- method: resizeMethod,
- maxwidth: maxwidth,
- maxheight: maxheight,
- crop: crop,
- follow_orientation: follow_orientation,
- image_id: elements[i],
- format: 'json'
- },
- dataType: 'json',
- success: ( function(data) { progress(++todo, progressBar_max, data['result']) }),
- error: ( function(data) { progress(++todo, progressBar_max, false) })
- });
- }
- return false;
+ if (jQuery('[name="selectAction"]').val() != 'generate_derivatives')
+ {
+ return true;
+ }
+ if (generate_derivatives_done)
+ {
+ return true;
+ }
+
+ jQuery('.bulkAction').hide();
+
+ var queuedManager = jQuery.manageAjax.create('queued', {
+ queue: true,
+ cacheResponse: false,
+ maxRequests: 1
+ });
+
+ if (jQuery('input[name="setSelected"]').attr('checked'))
+ elements = all_elements;
+ else
+ jQuery('input[name="selection[]"]').each(function() {
+ if (jQuery(this).attr('checked')) {
+ elements.push(jQuery(this).val());
+ }
+ });
+
+ progressBar_max = 0;
+ todo = 0;
+
+ jQuery('#applyActionBlock').hide();
+ jQuery('select[name="selectAction"]').hide();
+ jQuery('#regenerationMsg').show();
+
+ jQuery('#progressBar').progressBar(0, {
+ max: progressBar_max,
+ textFormat: 'fraction',
+ boxImage: 'themes/default/images/progressbar.gif',
+ barImage: 'themes/default/images/progressbg_orange.gif'
+ });
+
+ getDerivativeUrls();
+ return false;
});
- function toggleCropFields(prefix) {
- if (jQuery("#"+prefix+"_crop").is(':checked')) {
- jQuery("#"+prefix+"_width_th").text(width_str);
- jQuery("#"+prefix+"_height_th").text(height_str);
- jQuery("#"+prefix+"_follow_orientation_tr").show();
- }
- else {
- jQuery("#"+prefix+"_width_th").text(max_width_str);
- jQuery("#"+prefix+"_height_th").text(max_height_str);
- jQuery("#"+prefix+"_follow_orientation_tr").hide();
- }
- }
-
- toggleCropFields("thumb");
- jQuery("#thumb_crop").click(function () {toggleCropFields("thumb")});
+ function getDerivativeUrls() {
+ if (elements.length==0)
+ return;
+ var ids = elements.splice(0, 500);
+ var params = {max_urls: 100000, ids: ids, types: []};
+ jQuery("#action_generate_derivatives input").each( function(i, t) {
+ if ($(t).attr("checked"))
+ params.types.push( t.value );
+ } );
+
+ jQuery.ajax( {
+ type: "POST",
+ url: 'ws.php?format=json&method=pwg.getMissingDerivatives',
+ data: params,
+ dataType: "json",
+ success: function(data) {
+ if (!data.stat || data.stat != "ok") {
+ return;
+ }
+ progressBar_max += data.result.urls.length;
+ progress(todo, progressBar_max);
+ for (var i=0; i < data.result.urls.length; i++) {
+ jQuery.manageAjax.add("queued", {
+ type: 'GET',
+ url: data.result.urls[i] + "&ajaxload=true",
+ dataType: 'json',
+ success: ( function(data) { progress(++todo, progressBar_max, true) }),
+ error: ( function(data) { progress(++todo, progressBar_max, false) })
+ });
+ }
+ }
+ } );
+ }
checkPermitAction()
});
jQuery(window).load(function() {
- var max_dim = 0;
- $(".thumbnails img").each(function () {
- max_dim = Math.max(max_dim, $(this).height(), $(this).width() );
- });
- max_dim += 35;
- $("ul.thumbnails span, ul.thumbnails label").css('width', max_dim+'px').css('height', max_dim+'px');
- $('ul.thumbnails').enableShiftClick();
+ var max_w=0, max_h=0;
+ $(".thumbnails img").each(function () {
+ max_w = Math.max(max_w, $(this).width() );
+ max_h = Math.max(max_h, $(this).height() );
+ });
+ max_w += 10;
+ max_h += 35;
+ $("ul.thumbnails span, ul.thumbnails label").css('width', max_w+'px').css('height', max_h+'px');
+ $('ul.thumbnails').enableShiftClick();
});
{/literal}{/footer_script}
@@ -603,33 +591,29 @@ jQuery(window).load(function() {
</p>
<ul class="thumbnails">
- {foreach from=$thumbnails item=thumbnail}
- {if in_array($thumbnail.ID, $selection)}
- {assign var='isSelected' value=true}
- {else}
- {assign var='isSelected' value=false}
- {/if}
-
- <li>
- <span class="wrap1">
- <label>
- <span class="wrap2{if $isSelected} thumbSelected{/if}">
- <div class="actions"><a href="{$thumbnail.FILE_SRC}" class="preview-box">{'Zoom'|@translate}</a> &middot; <a href="{$thumbnail.U_EDIT}" target="_blank">{'Edit'|@translate}</a></div>
- {if $thumbnail.LEVEL > 0}
- <em class="levelIndicatorB">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.LEVEL))}</em>
- <em class="levelIndicatorF" title="{'Who can see these photos?'|@translate} : ">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.LEVEL))}</em>
- {/if}
- <span>
- <img src="{$thumbnail.TN_SRC}"
- alt="{$thumbnail.FILE}"
- title="{$thumbnail.TITLE|@escape:'html'}"
- class="thumbnail">
- </span>
- </span>
- <input type="checkbox" name="selection[]" value="{$thumbnail.ID}" {if $isSelected}checked="checked"{/if}>
- </label>
- </span>
- </li>
+ {foreach from=$thumbnails item=thumbnail}
+ {if in_array($thumbnail.ID, $selection)}
+ {assign var='isSelected' value=true}
+ {else}
+ {assign var='isSelected' value=false}
+ {/if}
+ <li>
+ <span class="wrap1">
+ <label>
+ <span class="wrap2{if $isSelected} thumbSelected{/if}">
+ <div class="actions"><a href="{$thumbnail.FILE_SRC}" class="preview-box">{'Zoom'|@translate}</a> &middot; <a href="{$thumbnail.U_EDIT}" target="_blank">{'Edit'|@translate}</a></div>
+ {if $thumbnail.LEVEL > 0}
+ <em class="levelIndicatorB">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.LEVEL))}</em>
+ <em class="levelIndicatorF" title="{'Who can see these photos?'|@translate} : ">{$pwg->l10n($pwg->sprintf('Level %d',$thumbnail.LEVEL))}</em>
+ {/if}
+ <span>
+ <img src="{$thumbnail.TN_SRC}" alt="{$thumbnail.FILE}" title="{$thumbnail.TITLE|@escape:'html'}" class="thumbnail">
+ </span>
+ </span>
+ <input type="checkbox" name="selection[]" value="{$thumbnail.ID}" {if $isSelected}checked="checked"{/if}>
+ </label>
+ </span>
+ </li>
{/foreach}
</ul>
@@ -686,8 +670,8 @@ jQuery(window).load(function() {
{else}
<option value="add_to_caddie">{'Add to caddie'|@translate}</option>
{/if}
- <option value="regenerateThumbnails">{'Regenerate Thumbnails'|@translate}</option>
- <option value="regenerateWebsize">{'Regenerate Websize Photos'|@translate}</option>
+ <option value="delete_derivatives">{'Delete multiple size images'|@translate}</option>
+ <option value="generate_derivatives">{'Generate multiple size images'|@translate}</option>
{if !empty($element_set_global_plugins_actions)}
{foreach from=$element_set_global_plugins_actions item=action}
<option value="{$action.ID}">{$action.NAME}</option>
@@ -784,59 +768,45 @@ jQuery(window).load(function() {
<div id="action_metadata" class="bulkAction">
</div>
- <!-- regenerate thumbnails -->
- <div id="action_regenerateThumbnails" class="bulkAction">
- <table style="margin-left:20px;">
- <tr>
- <th><label for="thumb_crop">{'Crop'|@translate}</label></th>
- <td><input type="checkbox" name="thumb_crop" id="thumb_crop" {if $upload_form_settings.thumb_crop}checked="checked"{/if}></td>
- </tr>
- <tr id="thumb_follow_orientation_tr">
- <th><label for="thumb_follow_orientation">{'Follow Orientation'|@translate}</label></th>
- <td><input type="checkbox" name="thumb_follow_orientation" id="thumb_follow_orientation" {if $upload_form_settings.thumb_follow_orientation}checked="checked"{/if}></td>
- </tr>
- <tr>
- <th id="thumb_width_th">{'Maximum Width'|@translate}</th>
- <td><input type="text" name="thumb_maxwidth" value="{$upload_form_settings.thumb_maxwidth}" size="4" maxlength="4"> {'pixels'|@translate}</td>
- </tr>
- <tr>
- <th id="thumb_height_th">{'Maximum Height'|@translate}</th>
- <td><input type="text" name="thumb_maxheight" value="{$upload_form_settings.thumb_maxheight}" size="4" maxlength="4"> {'pixels'|@translate}</td>
- </tr>
- <tr>
- <th>{'Image Quality'|@translate}</th>
- <td><input type="text" name="thumb_quality" value="{$upload_form_settings.thumb_quality}" size="3" maxlength="3"> %</td>
- </tr>
- </table>
- </div>
-
- <!-- regenerate websize -->
- <div id="action_regenerateWebsize" class="bulkAction">
- <p>
- <img src="admin/themes/default/icon/warning.png" alt="!" style="vertical-align:middle;">
- {'By default, Piwigo will create a new websize from the HD (high definition) version of your photo.'|@translate}
- {'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}
- </p>
-
- <table style="margin:10px 20px;">
- <tr>
- <th>{'Maximum Width'|@translate}</th>
- <td><input type="text" name="websize_maxwidth" value="{$upload_form_settings.websize_maxwidth}" size="4" maxlength="4"> {'pixels'|@translate}</td>
- </tr>
- <tr>
- <th>{'Maximum Height'|@translate}</th>
- <td><input type="text" name="websize_maxheight" value="{$upload_form_settings.websize_maxheight}" size="4" maxlength="4"> {'pixels'|@translate}</td>
- </tr>
- <tr>
- <th>{'Image Quality'|@translate}</th>
- <td><input type="text" name="websize_quality" value="{$upload_form_settings.websize_quality}" size="3" maxlength="3"> %</td>
- </tr>
- </table>
- </div>
-
+ <!-- generate derivatives -->
+ <div id="action_generate_derivatives" class="bulkAction">
+ <a href="javascript:selectGenerateDerivAll()">{'All'|@translate}</a>,
+ <a href="javascript:selectGenerateDerivNone()">{'None'|@translate}</a>
+ <br>
+ {foreach from=$generate_derivatives_types key=type item=disp}
+ <label><input type="checkbox" name="generate_derivatives_type[]" value="{$type}"> {$disp}</label>
+ {/foreach}
+ {footer_script}
+ function selectGenerateDerivAll() {ldelim}
+ $("#action_generate_derivatives input[type=checkbox]").attr("checked", true);
+ }
+ function selectGenerateDerivNone() {ldelim}
+ $("#action_generate_derivatives input[type=checkbox]").attr("checked", false);
+ }
+ {/footer_script}
+ </div>
+
+ <!-- delete derivatives -->
+ <div id="action_delete_derivatives" class="bulkAction">
+ <a href="javascript:selectDelDerivAll()">{'All'|@translate}</a>,
+ <a href="javascript:selectDelDerivNone()">{'None'|@translate}</a>
+ <br>
+ {foreach from=$del_derivatives_types key=type item=disp}
+ <label><input type="checkbox" name="del_derivatives_type[]" value="{$type}"> {$disp}</label>
+ {/foreach}
+ {footer_script}
+ function selectDelDerivAll() {ldelim}
+ $("#action_delete_derivatives input[type=checkbox]").attr("checked", true);
+ }
+ function selectDelDerivNone() {ldelim}
+ $("#action_delete_derivatives input[type=checkbox]").attr("checked", false);
+ }
+ {/footer_script}
+ </div>
+
<!-- progress bar -->
- <div id="regenerationMsg" class="bulkAction">
- <p id="regenerationText" style="margin-bottom:10px;"></p>
+ <div id="regenerationMsg" class="bulkAction" style="display:none">
+ <p id="regenerationText" style="margin-bottom:10px;">{'Generate multiple size images'|@translate}</p>
<span class="progressBar" id="progressBar"></span>
<input type="hidden" name="regenerateSuccess" value="0">
<input type="hidden" name="regenerateError" value="0">
diff --git a/admin/themes/default/template/maintenance.tpl b/admin/themes/default/template/maintenance.tpl
index f55d10d2e..fc568fa42 100644
--- a/admin/themes/default/template/maintenance.tpl
+++ b/admin/themes/default/template/maintenance.tpl
@@ -34,7 +34,7 @@
<li><a href="{$U_MAINT_FEEDS}">{'Purge never used notification feeds'|@translate}</a></li>
<li><a href="{$U_MAINT_SEARCH}"onclick="return confirm('{'Purge search history'|@translate|@escape:'javascript'}');">{'Purge search history'|@translate}</a></li>
<li><a href="{$U_MAINT_COMPILED_TEMPLATES}">{'Purge compiled templates'|@translate}</a></li>
- <li>{'Purge derivative image cache'|@translate}:
+ <li>{'Delete multiple size images'|@translate}:
{foreach from=$purge_derivatives key=name item=url name=loop}{if !$smarty.foreach.loop.first}, {/if}<a href="{$url}">{$name}</a>{/foreach}
</li>
</ul>
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php
index 4eb3fb3ce..fd24b1136 100644
--- a/include/ws_functions.inc.php
+++ b/include/ws_functions.inc.php
@@ -219,6 +219,10 @@ function ws_getMissingDerivatives($params, &$service)
$qlimit = min(5000, ceil(max($image_count/500, $max_urls/count($types))));
$where_clauses = ws_std_image_sql_filter( $params, '' );
$where_clauses[] = 'id<start_id';
+ if ( !empty($params['ids']) )
+ {
+ $where_clauses[] = 'id IN ('.implode(',',$params['ids']).')';
+ }
$query_model = 'SELECT id, path, representative_ext, width, height
FROM '.IMAGES_TABLE.'
@@ -3266,157 +3270,6 @@ function ws_themes_performAction($params, &$service)
}
}
-function ws_images_resizethumbnail($params, &$service)
-{
- if (!is_admin())
- {
- return new PwgError(401, 'Access denied');
- }
-
- if (empty($params['image_id']) and empty($params['image_path']))
- {
- return new PwgError(403, "image_id or image_path is missing");
- }
-
- include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');
- include_once(PHPWG_ROOT_PATH.'admin/include/image.class.php');
-
- if (!empty($params['image_id']))
- {
- $query='
-SELECT id, path, tn_ext, has_high
- FROM '.IMAGES_TABLE.'
- WHERE id = '.(int)$params['image_id'].'
-;';
- $image = pwg_db_fetch_assoc(pwg_query($query));
-
- if ($image == null)
- {
- return new PwgError(403, "image_id not found");
- }
-
- $image_path = $image['path'];
- $thumb_path = get_thumbnail_path($image);
- }
- else
- {
- $image_path = $params['image_path'];
- $thumb_path = file_path_for_type($image_path, 'thumb');
- }
-
- if (!file_exists($image_path) or !is_valid_image_extension(get_extension($image_path)))
- {
- return new PwgError(403, "image can't be resized");
- }
-
- $result = false;
- prepare_directory(dirname($thumb_path));
- $img = new pwg_image($image_path, $params['library']);
-
- if (!is_bool($params['crop']))
- $params['crop'] = get_boolean($params['crop']);
- if (!is_bool($params['follow_orientation']))
- $params['follow_orientation'] = get_boolean($params['follow_orientation']);
-
- $result = $img->pwg_resize(
- $thumb_path,
- $params['maxwidth'],
- $params['maxheight'],
- $params['quality'],
- false, // automatic rotation is not needed for thumbnails.
- true, // strip metadata
- $params['crop'],
- $params['follow_orientation']
- );
-
- $img->destroy();
- return $result;
-}
-
-function ws_images_resizewebsize($params, &$service)
-{
- if (!is_admin())
- {
- return new PwgError(401, 'Access denied');
- }
-
- include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
- include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');
- include_once(PHPWG_ROOT_PATH.'admin/include/image.class.php');
-
- $query='
-SELECT id, path, tn_ext, has_high, width, height
- FROM '.IMAGES_TABLE.'
- WHERE id = '.(int)$params['image_id'].'
-;';
- $image = pwg_db_fetch_assoc(pwg_query($query));
-
- if ($image == null)
- {
- return new PwgError(403, "image_id not found");
- }
-
- $image_path = $image['path'];
-
- if (!is_valid_image_extension(get_extension($image_path)))
- {
- return new PwgError(403, "image can't be resized");
- }
-
- $hd_path = get_high_path($image);
-
- if (empty($image['has_high']) or !file_exists($hd_path))
- {
- if ($image['width'] > $params['maxwidth'] or $image['height'] > $params['maxheight'])
- {
- $hd_path = file_path_for_type($image_path, 'high');
- $hd_dir = dirname($hd_path);
- prepare_directory($hd_dir);
-
- rename($image_path, $hd_path);
- $hd_infos = pwg_image_infos($hd_path);
-
- single_update(
- IMAGES_TABLE,
- array(
- 'has_high' => 'true',
- 'high_filesize' => $hd_infos['filesize'],
- 'high_width' => $hd_infos['width'],
- 'high_height' => $hd_infos['height'],
- ),
- array(
- 'id' => $image['id']
- )
- );
- }
- else
- {
- return new PwgError(403, "image can't be resized");
- }
- }
-
- $result = false;
- $img = new pwg_image($hd_path, $params['library']);
-
- $result = $img->pwg_resize(
- $image_path,
- $params['maxwidth'],
- $params['maxheight'],
- $params['quality'],
- $params['automatic_rotation'],
- false // strip metadata
- );
-
- $img->destroy();
-
- global $conf;
- $conf['use_exif'] = false;
- $conf['use_iptc'] = false;
- sync_metadata(array($image['id']));
-
- return $result;
-}
-
function ws_extensions_update($params, &$service)
{
if (!is_webmaster())
diff --git a/language/en_UK/admin.lang.php b/language/en_UK/admin.lang.php
index b080b13d3..b355e96c5 100644
--- a/language/en_UK/admin.lang.php
+++ b/language/en_UK/admin.lang.php
@@ -78,8 +78,6 @@ $lang['%s has been successfully updated.'] = "%s has been successfully updated."
$lang['%s must be to set to false in your local/config/config.inc.php file'] = "%s must be set to false in your local/config/config.inc.php file";
$lang['%s photos can not be regenerated'] = '%s photos can not be regenerated';
$lang['%s photos have been regenerated'] = '%s photos have been regenerated';
-$lang['%s thumbnails can not be regenerated'] = '%s thumbnails can not be regenerated';
-$lang['%s thumbnails have been regenerated'] = '%s thumbnails have been regenerated';
$lang['%s value is not correct file because exif are not supported'] = "%s value is incorrect because exif are not supported";
$lang['(this tag will be deleted)'] = '(this tag will be deleted)';
$lang['+ Add an upload box'] = '+ Add an upload box';
@@ -572,8 +570,6 @@ $lang['Read Piwigo Documentation'] = 'Read Piwigo Documentation';
$lang['reduce to single existing albums'] = "reduce to single existing albums";
$lang['Refresh photo set'] = 'Refresh photo set';
$lang['Refresh'] = "Refresh";
-$lang['Regenerate Thumbnails'] = 'Regenerate Thumbnails';
-$lang['Regenerate Websize Photos'] = 'Regenerate Websize Photos';
$lang['registration date'] = "registration date";
$lang['Reinitialize check integrity'] = "Reinitialize integrity check";
$lang['Reject'] = "Reject";
@@ -866,4 +862,6 @@ $lang['Aperture is designed for professional photographers with iPhoto simplicit
$lang['The Piwigo export plugin allows you to create albums and export photos.'] = 'The Piwigo export plugin allows you to create albums and export photos.';
$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.';
$lang['Features include gallery browsing, album creation and photo upload.'] = 'Features include gallery browsing, album creation and photo upload.';
+$lang['Generate multiple size images']='Generate multiple size images';
+$lang['Delete multiple size images']='Delete multiple size images';
?> \ No newline at end of file
diff --git a/ws.php b/ws.php
index 45e4ae76d..998ee1d6c 100644
--- a/ws.php
+++ b/ws.php
@@ -89,6 +89,7 @@ function ws_addDefaultMethods( $arr )
$service->addMethod('pwg.getMissingDerivatives', 'ws_getMissingDerivatives',
array(
'types' => array( 'default'=>array(), 'flags'=>WS_PARAM_FORCE_ARRAY),
+ 'ids' => array( 'default'=>array(), 'flags'=>WS_PARAM_FORCE_ARRAY),
'max_urls' => array( 'default' => 200 ),
'prev_page' => array( 'default'=> null),
'f_min_rate' => array( 'default'=> null ),
@@ -459,37 +460,6 @@ function ws_addDefaultMethods( $arr )
);
$service->addMethod(
- 'pwg.images.resizeThumbnail',
- 'ws_images_resizethumbnail',
- array(
- 'image_id' => array('default' => null),
- 'image_path' => array('default' => null),
- 'maxwidth' => array('default' => $conf['upload_form_thumb_maxwidth']),
- 'maxheight' => array('default' => $conf['upload_form_thumb_maxheight']),
- 'quality' => array('default' => $conf['upload_form_thumb_quality']),
- 'crop' => array('default' => $conf['upload_form_thumb_crop']),
- 'follow_orientation' => array('default' => $conf['upload_form_thumb_follow_orientation']),
- 'library' => array('default' => $conf['graphics_library']),
- ),
- 'Create/Regenerate thumbnails photo with given arguments.
-<br>One of arguments "image_id" or "image_path" must be sent.'
- );
-
- $service->addMethod(
- 'pwg.images.resizeWebsize',
- 'ws_images_resizewebsize',
- array(
- 'image_id' => array(),
- 'maxwidth' => array('default' => $conf['upload_form_websize_maxwidth']),
- 'maxheight' => array('default' => $conf['upload_form_websize_maxheight']),
- 'quality' => array('default' => $conf['upload_form_websize_quality']),
- 'automatic_rotation' => array('default' => $conf['upload_form_automatic_rotation']),
- 'library' => array('default' => $conf['graphics_library']),
- ),
- 'Regenerate websize photo with given arguments.'
- );
-
- $service->addMethod(
'pwg.extensions.update',
'ws_extensions_update',
array(