Index: /extensions/regenerateThumbnails/element_set_global_action.tpl
===================================================================
--- /extensions/regenerateThumbnails/element_set_global_action.tpl	(revision 9917)
+++ /extensions/regenerateThumbnails/element_set_global_action.tpl	(revision 9917)
@@ -0,0 +1,95 @@
+{combine_script id='jquery.progressBar' path='plugins/regenerateThumbnails/js/jquery.progressbar.min.js' load='footer'}
+{combine_script id='jquery.ajaxmanager' path='plugins/regenerateThumbnails/js/jquery.ajaxmanager.js' load='footer'}
+
+{footer_script require='jquery.progressBar,jquery.ajaxmanager'}
+var all_elements = [{','|@implode:$all_elements}];
+var redirect = '{$redirect_url}';
+
+{literal}
+var queuedManager = $.manageAjax.create('queued', { 
+	queue: true,  
+	cacheResponse: false,
+	maxRequests: 3
+});
+
+jQuery(document).ready(function() {
+  jQuery('#applyAction').click(function() {
+    if (jQuery('select[name="selectAction"]').val() == 'regenerateThumbnails') {
+      elements = new Array();
+      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());
+          }
+        });
+      maxwidth = jQuery('input[name="thumb_maxwidth"]').val();
+      maxheight = jQuery('input[name="thumb_maxheight"]').val();
+      square = jQuery('input[name="square"]').attr('checked');
+      progressBar_max = elements.length;
+      todo = 0;
+
+      jQuery('#thumb_config').hide();
+      jQuery('#applyActionBlock').hide();
+      jQuery('select[name="selectAction"]').hide();
+      jQuery('#regenerationMsg').show();
+
+      for (i=0;i<elements.length;i++) {
+        queuedManager.add({
+          type: 'GET', 
+          url: 'ws.php', 
+          data: {
+            method: 'pwg.images.regenerateThumbnail',
+            maxwidth: maxwidth,
+            maxheight: maxheight,
+            square: square,
+            image_id: elements[i],
+            format: 'json'
+          },
+          dataType: 'json',
+          success: ( function(data) {
+            if (data.stat =='ok')
+              jQuery('#progressBar').progressBar(++todo, {
+                max: progressBar_max,
+                textFormat: 'fraction',
+                boxImage: 'plugins/regenerateThumbnails/images/progressbar.gif',
+                barImage: 'plugins/regenerateThumbnails/images/progressbg_orange.gif'
+              });
+            if (todo == progressBar_max)
+              window.location = redirect+'&regeneratedThumbnail='+todo;
+          })
+        });
+      }
+      return false;
+    }
+  });
+});
+{/literal}{/footer_script}
+
+<table style="margin-left:20px;" id="thumb_config">
+{if isset($SQUARE)}
+<tr>
+  <th><label for="square">{'Square Thumbnails'|@translate}</label></th>
+  <td><input type="checkbox" name="square" id="square" {if $SQUARE}checked="checked"{/if}></td>
+</tr>
+{else}
+<tr><td><input type="checkbox" name="square" id="square" style="display:none;"></td></tr>
+{/if}
+  <tr>
+    <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>{'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 id="regenerationMsg" style="display:none;">{'Thumbnails generation in progress...'|@translate}<br><br>
+<span class="progressBar" id="progressBar"></span>
+</div>
Index: /extensions/regenerateThumbnails/index.php
===================================================================
--- /extensions/regenerateThumbnails/index.php	(revision 9917)
+++ /extensions/regenerateThumbnails/index.php	(revision 9917)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/regenerateThumbnails/js/jquery.ajaxmanager.js
===================================================================
--- /extensions/regenerateThumbnails/js/jquery.ajaxmanager.js	(revision 9917)
+++ /extensions/regenerateThumbnails/js/jquery.ajaxmanager.js	(revision 9917)
@@ -0,0 +1,342 @@
+/**!
+ * project-site: http://plugins.jquery.com/project/AjaxManager
+ * repository: http://github.com/aFarkas/Ajaxmanager
+ * @author Alexander Farkas
+ * @version 3.12
+ * Copyright 2010, Alexander Farkas
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ */
+
+(function($){
+	"use strict";
+	var managed = {},
+		cache   = {}
+	;
+	$.manageAjax = (function(){
+		function create(name, opts){
+			managed[name] = new $.manageAjax._manager(name, opts);
+			return managed[name];
+		}
+		
+		function destroy(name){
+			if(managed[name]){
+				managed[name].clear(true);
+				delete managed[name];
+			}
+		}
+
+		
+		var publicFns = {
+			create: create,
+			destroy: destroy
+		};
+		
+		return publicFns;
+	})();
+	
+	$.manageAjax._manager = function(name, opts){
+		this.requests = {};
+		this.inProgress = 0;
+		this.name = name;
+		this.qName = name;
+		
+		this.opts = $.extend({}, $.manageAjax.defaults, opts);
+		if(opts && opts.queue && opts.queue !== true && typeof opts.queue === 'string' && opts.queue !== 'clear'){
+			this.qName = opts.queue;
+		}
+	};
+	
+	$.manageAjax._manager.prototype = {
+		add: function(url, o){
+			if(typeof url == 'object'){
+				o = url;
+			} else if(typeof url == 'string'){
+				o = $.extend(o || {}, {url: url});
+			}
+			o = $.extend({}, this.opts, o);
+			
+			var origCom		= o.complete || $.noop,
+				origSuc		= o.success || $.noop,
+				beforeSend	= o.beforeSend || $.noop,
+				origError 	= o.error || $.noop,
+				strData 	= (typeof o.data == 'string') ? o.data : $.param(o.data || {}),
+				xhrID 		= o.type + o.url + strData,
+				that 		= this,
+				ajaxFn 		= this._createAjax(xhrID, o, origSuc, origCom)
+			;
+			if(o.preventDoubleRequests && o.queueDuplicateRequests){
+				if(o.preventDoubleRequests){
+					o.queueDuplicateRequests = false;
+				}
+				setTimeout(function(){
+					throw("preventDoubleRequests and queueDuplicateRequests can't be both true");
+				}, 0);
+			}
+			if(this.requests[xhrID] && o.preventDoubleRequests){
+				return;
+			}
+			ajaxFn.xhrID = xhrID;
+			o.xhrID = xhrID;
+			
+			o.beforeSend = function(xhr, opts){
+				var ret = beforeSend.call(this, xhr, opts);
+				if(ret === false){
+					that._removeXHR(xhrID);
+				}
+				xhr = null;
+				return ret;
+			};
+			o.complete = function(xhr, status){
+				that._complete.call(that, this, origCom, xhr, status, xhrID, o);
+				xhr = null;
+			};
+			
+			o.success = function(data, status, xhr){
+				that._success.call(that, this, origSuc, data, status, xhr, o);
+				xhr = null;
+			};
+						
+			//always add some error callback
+			o.error =  function(ahr, status, errorStr){
+				var httpStatus 	= '',
+					content 	= ''
+				;
+				if(status !== 'timeout' && ahr){
+					httpStatus = ahr.status;
+					content = ahr.responseXML || ahr.responseText;
+				}
+				if(origError) {
+					origError.call(this, ahr, status, errorStr, o);
+				} else {
+					setTimeout(function(){
+						throw status + '| status: ' + httpStatus + ' | URL: ' + o.url + ' | data: '+ strData + ' | thrown: '+ errorStr + ' | response: '+ content;
+					}, 0);
+				}
+				ahr = null;
+			};
+			
+			if(o.queue === 'clear'){
+				$(document).clearQueue(this.qName);
+			}
+			
+			if(o.queue || (o.queueDuplicateRequests && this.requests[xhrID])){
+				$.queue(document, this.qName, ajaxFn);
+				if(this.inProgress < o.maxRequests && (!this.requests[xhrID] || !o.queueDuplicateRequests)){
+					$.dequeue(document, this.qName);
+				}
+				return xhrID;
+			}
+			return ajaxFn();
+		},
+		_createAjax: function(id, o, origSuc, origCom){
+			var that = this;
+			return function(){
+				if(o.beforeCreate.call(o.context || that, id, o) === false){return;}
+				that.inProgress++;
+				if(that.inProgress === 1){
+					$.event.trigger(that.name +'AjaxStart');
+				}
+				if(o.cacheResponse && cache[id]){
+					if(!cache[id].cacheTTL || cache[id].cacheTTL < 0 || ((new Date().getTime() - cache[id].timestamp) < cache[id].cacheTTL)){
+                        that.requests[id] = {};
+                        setTimeout(function(){
+							that._success.call(that, o.context || o, origSuc, cache[id]._successData, 'success', cache[id], o);
+                        	that._complete.call(that, o.context || o, origCom, cache[id], 'success', id, o);
+                        }, 0);
+                    } else {
+						 delete cache[id];
+					}
+				} 
+				if(!o.cacheResponse || !cache[id]) {
+					if (o.async) {
+						that.requests[id] = $.ajax(o);
+					} else {
+						$.ajax(o);
+					}
+				}
+				return id;
+			};
+		},
+		_removeXHR: function(xhrID){
+			if(this.opts.queue || this.opts.queueDuplicateRequests){
+				$.dequeue(document, this.qName);
+			}
+			this.inProgress--;
+			this.requests[xhrID] = null;
+			delete this.requests[xhrID];
+		},
+		clearCache: function () {
+            cache = {};
+        },
+		_isAbort: function(xhr, status, o){
+			if(!o.abortIsNoSuccess || (!xhr && !status)){
+				return false;
+			}
+			var ret = !!(  ( !xhr || xhr.readyState === 0 || this.lastAbort === o.xhrID ) );
+			xhr = null;
+			return ret;
+		},
+		_complete: function(context, origFn, xhr, status, xhrID, o){
+			if(this._isAbort(xhr, status, o)){
+				status = 'abort';
+				o.abort.call(context, xhr, status, o);
+			}
+			origFn.call(context, xhr, status, o);
+			
+			$.event.trigger(this.name +'AjaxComplete', [xhr, status, o]);
+			
+			if(o.domCompleteTrigger){
+				$(o.domCompleteTrigger)
+					.trigger(this.name +'DOMComplete', [xhr, status, o])
+					.trigger('DOMComplete', [xhr, status, o])
+				;
+			}
+			
+			this._removeXHR(xhrID);
+			if(!this.inProgress){
+				$.event.trigger(this.name +'AjaxStop');
+			}
+			xhr = null;
+		},
+		_success: function(context, origFn, data, status, xhr, o){
+			var that = this;
+			if(this._isAbort(xhr, status, o)){
+				xhr = null;
+				return;
+			}
+			if(o.abortOld){
+				$.each(this.requests, function(name){
+					if(name === o.xhrID){
+						return false;
+					}
+					that.abort(name);
+				});
+			}
+			if(o.cacheResponse && !cache[o.xhrID]){
+				if(!xhr){
+					xhr = {};
+				}
+				cache[o.xhrID] = {
+					status: xhr.status,
+					statusText: xhr.statusText,
+					responseText: xhr.responseText,
+					responseXML: xhr.responseXML,
+					_successData: data,
+					cacheTTL: o.cacheTTL, 
+					timestamp: new Date().getTime()
+				};
+				if('getAllResponseHeaders' in xhr){
+					var responseHeaders = xhr.getAllResponseHeaders();
+					var parsedHeaders;
+					var parseHeaders = function(){
+						if(parsedHeaders){return;}
+						parsedHeaders = {};
+						$.each(responseHeaders.split("\n"), function(i, headerLine){
+							var delimiter = headerLine.indexOf(":");
+		                    parsedHeaders[headerLine.substr(0, delimiter)] = headerLine.substr(delimiter + 2);
+						});
+					};
+					$.extend(cache[o.xhrID], {
+						getAllResponseHeaders: function() {return responseHeaders;},
+						getResponseHeader: function(name) {
+							parseHeaders();
+							return (name in parsedHeaders) ? parsedHeaders[name] : null;
+						}
+					});
+				}
+			}
+			origFn.call(context, data, status, xhr, o);
+			$.event.trigger(this.name +'AjaxSuccess', [xhr, o, data]);
+			if(o.domSuccessTrigger){
+				$(o.domSuccessTrigger)
+					.trigger(this.name +'DOMSuccess', [data, o])
+					.trigger('DOMSuccess', [data, o])
+				;
+			}
+			xhr = null;
+		},
+		getData: function(id){
+			if( id ){
+				var ret = this.requests[id];
+				if(!ret && this.opts.queue) {
+					ret = $.grep($(document).queue(this.qName), function(fn, i){
+						return (fn.xhrID === id);
+					})[0];
+				}
+				return ret;
+			}
+			return {
+				requests: this.requests,
+				queue: (this.opts.queue) ? $(document).queue(this.qName) : [],
+				inProgress: this.inProgress
+			};
+		},
+		abort: function(id){
+			var xhr;
+			if(id){
+				xhr = this.getData(id);
+				
+				if(xhr && xhr.abort){
+					this.lastAbort = id;
+					xhr.abort();
+					this.lastAbort = false;
+				} else {
+					$(document).queue(
+						this.qName, $.grep($(document).queue(this.qName), function(fn, i){
+							return (fn !== xhr);
+						})
+					);
+				}
+				xhr = null;
+				return;
+			}
+			
+			var that 	= this,
+				ids 	= []
+			;
+			$.each(this.requests, function(id){
+				ids.push(id);
+			});
+			$.each(ids, function(i, id){
+				that.abort(id);
+			});
+		},
+		clear: function(shouldAbort){
+			$(document).clearQueue(this.qName); 
+			if(shouldAbort){
+				this.abort();
+			}
+		}
+	};
+	$.manageAjax._manager.prototype.getXHR = $.manageAjax._manager.prototype.getData;
+	$.manageAjax.defaults = {
+		beforeCreate: $.noop,
+		abort: $.noop,
+		abortIsNoSuccess: true,
+		maxRequests: 1,
+		cacheResponse: false,
+		async: true,
+		domCompleteTrigger: false,
+		domSuccessTrigger: false,
+		preventDoubleRequests: true,
+		queueDuplicateRequests: false,
+		cacheTTL: -1,
+		queue: false // true, false, clear
+	};
+	
+	$.each($.manageAjax._manager.prototype, function(n, fn){
+		if(n.indexOf('_') === 0 || !$.isFunction(fn)){return;}
+		$.manageAjax[n] =  function(name, o){
+			if(!managed[name]){
+				if(n === 'add'){
+					$.manageAjax.create(name, o);
+				} else {
+					return;
+				}
+			}
+			var args = Array.prototype.slice.call(arguments, 1);
+			managed[name][n].apply(managed[name], args);
+		};
+	});
+	
+})(jQuery);
Index: /extensions/regenerateThumbnails/js/jquery.progressbar.js
===================================================================
--- /extensions/regenerateThumbnails/js/jquery.progressbar.js	(revision 9917)
+++ /extensions/regenerateThumbnails/js/jquery.progressbar.js	(revision 9917)
@@ -0,0 +1,186 @@
+/*
+ * jQuery Progress Bar plugin
+ * Version 2.0 (06/22/2009)
+ * @requires jQuery v1.2.1 or later
+ *
+ * Copyright (c) 2008 Gary Teo
+ * http://t.wits.sg
+
+USAGE:
+	$(".someclass").progressBar();
+	$("#progressbar").progressBar();
+	$("#progressbar").progressBar(45);							// percentage
+	$("#progressbar").progressBar({showText: false });			// percentage with config
+	$("#progressbar").progressBar(45, {showText: false });		// percentage with config
+*/
+(function($) {
+	$.extend({
+		progressBar: new function() {
+
+			this.defaults = {
+				steps			: 20,											// steps taken to reach target
+				stepDuration	: 20,											
+				max				: 100,											// Upon 100% i'd assume, but configurable
+				showText		: true,											// show text with percentage in next to the progressbar? - default : true
+				textFormat		: 'percentage',									// Or otherwise, set to 'fraction'
+				width			: 120,											// Width of the progressbar - don't forget to adjust your image too!!!												// Image to use in the progressbar. Can be a single image too: 'images/progressbg_green.gif'
+				height			: 12,											// Height of the progressbar - don't forget to adjust your image too!!!
+				callback		: null,											// Calls back with the config object that has the current percentage, target percentage, current image, etc
+				boxImage		: 'images/progressbar.gif',						// boxImage : image around the progress bar
+				barImage		: {
+									0:	'images/progressbg_red.gif',
+									30: 'images/progressbg_orange.gif',
+									70: 'images/progressbg_green.gif'
+								},
+				
+				
+				// Internal use
+				running_value	: 0,
+				value			: 0,
+				image			: null
+			};
+			
+			/* public methods */
+			this.construct = function(arg1, arg2) {
+				var argvalue	= null;
+				var argconfig	= null;
+				
+				if (arg1 != null) {
+					if (!isNaN(arg1)) {
+						argvalue = arg1;
+						if (arg2 != null) {
+							argconfig = arg2;
+						}
+					} else {
+						argconfig = arg1; 
+					}
+				}
+				
+				return this.each(function(child) {
+					var pb		= this;
+					var config	= this.config;
+					
+					if (argvalue != null && this.bar != null && this.config != null) {
+						this.config.value 		= parseInt(argvalue)
+						if (argconfig != null)
+							pb.config			= $.extend(this.config, argconfig);
+						config	= pb.config;
+					} else {
+						var $this				= $(this);
+						var config				= $.extend({}, $.progressBar.defaults, argconfig);
+						config.id				= $this.attr('id') ? $this.attr('id') : Math.ceil(Math.random() * 100000);	// random id, if none provided
+						
+						if (argvalue == null)
+							argvalue	= $this.html().replace("%","")	// parse percentage
+						
+						config.value			= parseInt(argvalue);
+						config.running_value	= 0;
+						config.image			= getBarImage(config);
+						
+						var numeric = ['steps', 'stepDuration', 'max', 'width', 'height', 'running_value', 'value'];
+						for (var i=0; i<numeric.length; i++) 
+							config[numeric[i]] = parseInt(config[numeric[i]]);
+						
+						$this.html("");
+						var bar					= document.createElement('img');
+						var text				= document.createElement('span');
+						var $bar				= $(bar);
+						var $text				= $(text);
+						pb.bar					= $bar;
+						
+						$bar.attr('id', config.id + "_pbImage");
+						$text.attr('id', config.id + "_pbText");
+						$text.html(getText(config));
+						$bar.attr('title', getText(config));
+						$bar.attr('alt', getText(config));
+						$bar.attr('src', config.boxImage);
+						$bar.attr('width', config.width);
+						$bar.css("width", config.width + "px");
+						$bar.css("height", config.height + "px");
+						$bar.css("background-image", "url(" + config.image + ")");
+						$bar.css("background-position", ((config.width * -1)) + 'px 50%');
+						$bar.css("padding", "0");
+						$bar.css("margin", "0");
+						$this.append($bar);
+						$this.append($text);
+					}
+
+					function getPercentage(config) {
+						return config.running_value * 100 / config.max;
+					}
+
+					function getBarImage(config) {
+						var image = config.barImage;
+						if (typeof(config.barImage) == 'object') {
+							for (var i in config.barImage) {
+								if (config.running_value >= parseInt(i)) {
+									image = config.barImage[i];
+								} else { break; }
+							}
+						}
+						return image;
+					}
+					
+					function getText(config) {
+						if (config.showText) {
+							if (config.textFormat == 'percentage') {
+								return " " + Math.round(config.running_value) + "%";
+							} else if (config.textFormat == 'fraction') {
+								return " " + config.running_value + '/' + config.max;
+							}
+						}
+					}
+					
+					config.increment = Math.round((config.value - config.running_value)/config.steps);
+					if (config.increment < 0)
+						config.increment *= -1;
+					if (config.increment < 1)
+						config.increment = 1;
+					
+					var t = setInterval(function() {
+						var pixels	= config.width / 100;			// Define how many pixels go into 1%
+						
+						if (config.running_value > config.value) {
+							if (config.running_value - config.increment  < config.value) {
+								config.running_value = config.value;
+							} else {
+								config.running_value -= config.increment;
+							}
+						}
+						else if (config.running_value < config.value) {
+							if (config.running_value + config.increment  > config.value) {
+								config.running_value = config.value;
+							} else {
+								config.running_value += config.increment;
+							}
+						}
+						
+						if (config.running_value == config.value)
+							clearInterval(t);
+						
+						var $bar	= $("#" + config.id + "_pbImage");
+						var $text	= $("#" + config.id + "_pbText");
+						var image	= getBarImage(config);
+						if (image != config.image) {
+							$bar.css("background-image", "url(" + image + ")");
+							config.image = image;
+						}
+						$bar.css("background-position", (((config.width * -1)) + (getPercentage(config) * pixels)) + 'px 50%');
+						$bar.attr('title', getText(config));
+						$text.html(getText(config));
+						
+						if (config.callback != null && typeof(config.callback) == 'function')
+							config.callback(config);
+						
+						pb.config = config;
+					}, config.stepDuration); 
+				});
+			};
+		}
+	});
+		
+	$.fn.extend({
+        progressBar: $.progressBar.construct
+	});
+	
+})(jQuery);
Index: /extensions/regenerateThumbnails/js/jquery.progressbar.min.js
===================================================================
--- /extensions/regenerateThumbnails/js/jquery.progressbar.min.js	(revision 9917)
+++ /extensions/regenerateThumbnails/js/jquery.progressbar.min.js	(revision 9917)
@@ -0,0 +1,20 @@
+
+(function($){$.extend({progressBar:new function(){this.defaults={steps:20,stepDuration:20,max:100,showText:true,textFormat:'percentage',width:120,height:12,callback:null,boxImage:'images/progressbar.gif',barImage:{0:'images/progressbg_red.gif',30:'images/progressbg_orange.gif',70:'images/progressbg_green.gif'},running_value:0,value:0,image:null};this.construct=function(arg1,arg2){var argvalue=null;var argconfig=null;if(arg1!=null){if(!isNaN(arg1)){argvalue=arg1;if(arg2!=null){argconfig=arg2;}}else{argconfig=arg1;}}
+return this.each(function(child){var pb=this;var config=this.config;if(argvalue!=null&&this.bar!=null&&this.config!=null){this.config.value=parseInt(argvalue)
+if(argconfig!=null)
+pb.config=$.extend(this.config,argconfig);config=pb.config;}else{var $this=$(this);var config=$.extend({},$.progressBar.defaults,argconfig);config.id=$this.attr('id')?$this.attr('id'):Math.ceil(Math.random()*100000);if(argvalue==null)
+argvalue=$this.html().replace("%","")
+config.value=parseInt(argvalue);config.running_value=0;config.image=getBarImage(config);var numeric=['steps','stepDuration','max','width','height','running_value','value'];for(var i=0;i<numeric.length;i++)
+config[numeric[i]]=parseInt(config[numeric[i]]);$this.html("");var bar=document.createElement('img');var text=document.createElement('span');var $bar=$(bar);var $text=$(text);pb.bar=$bar;$bar.attr('id',config.id+"_pbImage");$text.attr('id',config.id+"_pbText");$text.html(getText(config));$bar.attr('title',getText(config));$bar.attr('alt',getText(config));$bar.attr('src',config.boxImage);$bar.attr('width',config.width);$bar.css("width",config.width+"px");$bar.css("height",config.height+"px");$bar.css("background-image","url("+config.image+")");$bar.css("background-position",((config.width*-1))+'px 50%');$bar.css("padding","0");$bar.css("margin","0");$this.append($bar);$this.append($text);}
+function getPercentage(config){return config.running_value*100/config.max;}
+function getBarImage(config){var image=config.barImage;if(typeof(config.barImage)=='object'){for(var i in config.barImage){if(config.running_value>=parseInt(i)){image=config.barImage[i];}else{break;}}}
+return image;}
+function getText(config){if(config.showText){if(config.textFormat=='percentage'){return" "+Math.round(config.running_value)+"%";}else if(config.textFormat=='fraction'){return" "+config.running_value+'/'+config.max;}}}
+config.increment=Math.round((config.value-config.running_value)/config.steps);if(config.increment<0)
+config.increment*=-1;if(config.increment<1)
+config.increment=1;var t=setInterval(function(){var pixels=config.width/100;if(config.running_value>config.value){if(config.running_value-config.increment<config.value){config.running_value=config.value;}else{config.running_value-=config.increment;}}
+else if(config.running_value<config.value){if(config.running_value+config.increment>config.value){config.running_value=config.value;}else{config.running_value+=config.increment;}}
+if(config.running_value==config.value)
+clearInterval(t);var $bar=$("#"+config.id+"_pbImage");var $text=$("#"+config.id+"_pbText");var image=getBarImage(config);if(image!=config.image){$bar.css("background-image","url("+image+")");config.image=image;}
+$bar.css("background-position",(((config.width*-1))+(getPercentage(config)*pixels))+'px 50%');$bar.attr('title',getText(config));$text.html(getText(config));if(config.callback!=null&&typeof(config.callback)=='function')
+config.callback(config);pb.config=config;},config.stepDuration);});};}});$.fn.extend({progressBar:$.progressBar.construct});})(jQuery);
Index: /extensions/regenerateThumbnails/language/en_UK/index.php
===================================================================
--- /extensions/regenerateThumbnails/language/en_UK/index.php	(revision 9917)
+++ /extensions/regenerateThumbnails/language/en_UK/index.php	(revision 9917)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/regenerateThumbnails/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/regenerateThumbnails/language/en_UK/plugin.lang.php	(revision 9917)
+++ /extensions/regenerateThumbnails/language/en_UK/plugin.lang.php	(revision 9917)
@@ -0,0 +1,7 @@
+<?php
+
+$lang['Regenerate Thumbnails'] = 'Regenerate Thumbnails';
+$lang['Thumbnails generation in progress...'] = 'Thumbnails generation in progress...';
+$lang['%s thumbnails have been regenerated'] = '%s thumbnails have been regenerated';
+
+?>
Index: /extensions/regenerateThumbnails/language/fr_FR/index.php
===================================================================
--- /extensions/regenerateThumbnails/language/fr_FR/index.php	(revision 9917)
+++ /extensions/regenerateThumbnails/language/fr_FR/index.php	(revision 9917)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/regenerateThumbnails/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/regenerateThumbnails/language/fr_FR/plugin.lang.php	(revision 9917)
+++ /extensions/regenerateThumbnails/language/fr_FR/plugin.lang.php	(revision 9917)
@@ -0,0 +1,7 @@
+<?php
+
+$lang['Regenerate Thumbnails'] = 'Régénérer les miniatures';
+$lang['Thumbnails generation in progress...'] = 'Génération des miniatures en cours...';
+$lang['%s thumbnails have been regenerated'] = '%s miniatures ont été régénérées.';
+
+?>
Index: /extensions/regenerateThumbnails/language/index.php
===================================================================
--- /extensions/regenerateThumbnails/language/index.php	(revision 9917)
+++ /extensions/regenerateThumbnails/language/index.php	(revision 9917)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery                                  |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/regenerateThumbnails/main.inc.php
===================================================================
--- /extensions/regenerateThumbnails/main.inc.php	(revision 9917)
+++ /extensions/regenerateThumbnails/main.inc.php	(revision 9917)
@@ -0,0 +1,133 @@
+<?php
+/*
+Plugin Name: Thumbnails Regeneration
+Version: 2.2.0
+Description: Regenerate thumbnails
+Author: P@t
+*/
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+define('REGENERATE_THUMBNAILS_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
+
+add_event_handler('loc_begin_element_set_global', 'rg_element_set_global_add_action');
+add_event_handler('element_set_global_action', 'rg_element_set_global_perform_action');
+add_event_handler('ws_add_methods', 'add_regenerate_thumbnails_method');
+
+function rg_element_set_global_add_action()
+{
+  global $template, $conf, $page, $pwg_loaded_plugins;
+
+  load_language('plugin.lang', REGENERATE_THUMBNAILS_PATH);
+  include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');
+
+  $template->set_filename('regenerateThumbnails', realpath(REGENERATE_THUMBNAILS_PATH.'element_set_global_action.tpl'));
+
+  if (isset($_GET['regeneratedThumbnail']))
+  {
+    $template->delete_compiled_templates();
+    array_push($page['infos'], sprintf(l10n('%s thumbnails have been regenerated'), $_GET['regeneratedThumbnail']));
+    unset($_SESSION['regenerateThumbnail']);
+  }
+
+  foreach (get_upload_form_config() as $param_shortname => $param)
+  {
+    $param_name = 'upload_form_'.$param_shortname;
+    $form_values[$param_shortname] = $conf[$param_name];
+  }
+
+  if (isset($pwg_loaded_plugins['square_thumbnails']))
+  {
+    load_language('plugin.lang', SQUARE_THUMB_PATH);
+    $template->assign(array('SQUARE' => @$conf['upload_form_thumb_square']));
+  }
+
+  $template->assign(array(
+    'upload_form_settings' => $form_values,
+    'all_elements' => $page['cat_elements_id'],
+    'redirect_url' => get_root_url().'admin.php?page='.$_GET['page'],
+    )
+  );
+
+  $template->append('element_set_global_plugins_actions', array(
+    'ID' => 'regenerateThumbnails',
+    'NAME' => l10n('Regenerate Thumbnails'),
+    'CONTENT' => $template->parse('regenerateThumbnails', true),
+    )
+  );
+
+  $template->set_prefilter('batch_manager_global', 'regenerate_prefilter');
+}
+
+function rg_element_set_global_perform_action($action)
+{
+  global $page;
+
+  if ($action == 'my_action')
+  {
+    array_push($page['infos'], 'yo');
+  }
+}
+
+function add_regenerate_thumbnails_method($arr)
+{
+  global $conf;
+
+  $service = &$arr[0];
+  $service->addMethod(
+    'pwg.images.regenerateThumbnail',
+    'ws_images_regenerateThumbnail',
+    array(
+      'image_id'  => array(),
+      'maxwidth'  => array('default'=>$conf['upload_form_thumb_maxwidth']),
+      'maxheight' => array('default'=>$conf['upload_form_thumb_maxheight']),
+      'quality'   => array('default'=>$conf['upload_form_thumb_quality']),
+      'square'    => array('default'=>@$conf['upload_form_thumb_square']),
+    ),
+    'Regenerate a thumbnail with given arguments.'
+  );
+}
+
+function ws_images_regenerateThumbnail($params, &$service)
+{
+  global $conf;
+
+  if (!is_admin())
+    return new PwgError(401, 'Access denied');
+
+  $query='
+SELECT id, path
+FROM '.IMAGES_TABLE.'
+WHERE id = '.(int)$params['image_id'].'
+;';
+
+  $image = pwg_db_fetch_assoc(pwg_query($query));
+  if ($image == null)
+    return new PwgError(404, "image_id not found");
+
+  include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');
+
+  if ($params['square'] == 'true' or $params['square'] == 'false')
+    $params['square'] = get_boolean($params['square']);
+  if (!$params['square'])
+    remove_event_handler('upload_thumbnail_resize', 'upload_square_resize', 40);
+  
+  trigger_event(
+    'upload_thumbnail_resize',
+    false,
+    $image['path'],
+    file_path_for_type($image['path'], 'thumb'),
+    $params['maxwidth'],
+    $params['maxheight'],
+    $params['quality'],
+    true
+    );
+
+  return true;
+}
+
+function regenerate_prefilter($content, $smarty)
+{
+  return str_replace('{$thumbnail.TN_SRC}', '{$thumbnail.TN_SRC}?rand='.md5(uniqid(rand(), true)), $content);
+}
+
+?>
