{combine_script id='jquery.ajaxmanager' load='footer' path='themes/default/js/plugins/jquery.ajaxmanager.js'}
{footer_script}
var width_str = '{'Width'|@translate}';
var height_str = '{'Height'|@translate}';
var max_width_str = '{'Maximum Width'|@translate}';
var max_height_str = '{'Maximum Height'|@translate}';
var remaining = '{'photos without thumbnail (jpeg and png only)'|@translate}';
var todo = {$TOTAL_NB_REMAINING};
var done = 0;
{literal}
var queuedManager = $.manageAjax.create('queued', {
queue: true,
cacheResponse: false,
maxRequests: 3,
complete: function() {
jQuery("#thumb_remaining").text(todo-(++done) + ' ' + remaining);
if (todo == done) {
jQuery('.waiting_bar, #thumb_remaining, .properties').hide();
}
}
});
function processThumbs(width,height,crop,follow_orientation) {
jQuery('tr.nothumb').each(function() {
var image_path = jQuery(this).find('td.filepath').text();
var td=this;
queuedManager.add({
type: 'GET',
url: 'ws.php',
data: {
method: 'pwg.images.resizeThumbnail',
image_path: image_path,
maxwidth: width,
maxheight: height,
crop: crop,
follow_orientation: follow_orientation,
format:'json'
},
dataType: 'json',
success: (function(row) { return function(data) {
if (data.stat =='ok') {
if (todo < 200)
jQuery(row).find('td.thumbpic').html('');
jQuery(row).find('td.thumbdim').html(""+data.result.width+" x "+data.result.height);
jQuery(row).find('td.thumbgentime').html(""+data.result.time);
jQuery(row).find('td.thumbsize').html(""+data.result.size);
jQuery(row).removeClass("nothumb");
} else {
jQuery(row).find('td.thumbdim').html('#ERR#'+data.err+"# : "+data.message);
jQuery(row).removeClass("nothumb");
jQuery(row).addClass("error");
}
}
})(td)
});
});
}
function toggleCropFields() {
if (jQuery("#thumb_crop").is(':checked')) {
jQuery("label[for='thumb_maxwidth']").text(width_str);
jQuery("label[for='thumb_maxheight']").text(height_str);
jQuery("#thumb_follow_orientation_li").show();
}
else {
jQuery("label[for='thumb_maxwidth']").text(max_width_str);
jQuery("label[for='thumb_maxheight']").text(max_height_str);
jQuery("#thumb_follow_orientation_li").hide();
}
}
jQuery(document).ready(function(){
jQuery('input#proceed').click (function () {
var width = jQuery('input[name="thumb_maxwidth"]').val();
var height = jQuery('input[name="thumb_maxheight"]').val();
var crop = jQuery('#thumb_crop').is(':checked');
var follow_orientation = jQuery('#thumb_follow_orientation').is(':checked');
jQuery(".waiting_bar").toggle();
if (todo < 200)
jQuery('.thumbpic').show();
jQuery('.thumbgentime, .thumbsize, .thumbdim').show();
processThumbs(width,height,crop,follow_orientation);
});
jQuery('input#cancel').click (function () {
queuedManager.clear();
queuedManager.abort();
jQuery("input:not(.nodisable)").attr("disabled",false);
jQuery('tr.nothumb td.thumbpic').html(" ");
});
toggleCropFields();
jQuery("#thumb_crop").click(function () {toggleCropFields()});
jQuery('.thumbpic, .thumbgentime, .thumbsize, .thumbdim').hide();
});
{/literal}{/footer_script}
{'Path'|@translate} | {'Filesize'|@translate} | {'Dimensions'|@translate} | {'Thumbnail'|@translate} | {'generated in'|@translate} | {'Filesize'|@translate} | {'Dimensions'|@translate} | |
---|---|---|---|---|---|---|---|
{$smarty.foreach.remain_loop.iteration} | {$elt.PATH} | {$elt.FILESIZE_IMG} | {$elt.WIDTH_IMG} x {$elt.HEIGHT_IMG} | ![]() |
{'No missing thumbnail'|@translate}
{'If you want to regenerate thumbnails, please go to the Batch Manager.'|@translate|@sprintf:"admin.php?page=batch_manager"}