[10570] | 1 | {combine_script id='jquery.ajaxmanager' load='footer' path='themes/default/js/plugins/jquery.ajaxmanager.js'} |
---|
| 2 | |
---|
| 3 | {footer_script} |
---|
| 4 | var width_str = '{'Width'|@translate}'; |
---|
| 5 | var height_str = '{'Height'|@translate}'; |
---|
| 6 | var max_width_str = '{'Maximum Width'|@translate}'; |
---|
| 7 | var max_height_str = '{'Maximum Height'|@translate}'; |
---|
| 8 | var remaining = '{'photos without thumbnail (jpeg and png only)'|@translate}'; |
---|
| 9 | var todo = {$TOTAL_NB_REMAINING}; |
---|
| 10 | var done = 0; |
---|
| 11 | |
---|
| 12 | {literal} |
---|
| 13 | var queuedManager = $.manageAjax.create('queued', { |
---|
[10571] | 14 | queue: true, |
---|
| 15 | cacheResponse: false, |
---|
| 16 | maxRequests: 3, |
---|
[10570] | 17 | complete: function() { |
---|
| 18 | jQuery("#thumb_remaining").text(todo-(++done) + ' ' + remaining); |
---|
| 19 | if (todo == done) { |
---|
| 20 | jQuery('.waiting_bar, #thumb_remaining, .properties').hide(); |
---|
| 21 | } |
---|
| 22 | } |
---|
| 23 | }); |
---|
| 24 | |
---|
| 25 | function processThumbs(width,height,crop,follow_orientation) { |
---|
[10571] | 26 | jQuery('tr.nothumb').each(function() { |
---|
| 27 | var image_path = jQuery(this).find('td.filepath').text(); |
---|
| 28 | var td=this; |
---|
| 29 | queuedManager.add({ |
---|
| 30 | type: 'GET', |
---|
| 31 | url: 'ws.php', |
---|
| 32 | data: { |
---|
[10686] | 33 | method: 'pwg.images.resizeThumbnail', |
---|
[10570] | 34 | image_path: image_path, |
---|
| 35 | maxwidth: width, |
---|
| 36 | maxheight: height, |
---|
| 37 | crop: crop, |
---|
| 38 | follow_orientation: follow_orientation, |
---|
| 39 | format:'json' |
---|
| 40 | }, |
---|
[10571] | 41 | dataType: 'json', |
---|
| 42 | success: (function(row) { return function(data) { |
---|
| 43 | if (data.stat =='ok') { |
---|
[10570] | 44 | if (todo < 200) |
---|
| 45 | jQuery(row).find('td.thumbpic').html('<img src="'+data.result.destination+'"/>'); |
---|
| 46 | jQuery(row).find('td.thumbdim').html(""+data.result.width+" x "+data.result.height); |
---|
| 47 | jQuery(row).find('td.thumbgentime').html(""+data.result.time); |
---|
| 48 | jQuery(row).find('td.thumbsize').html(""+data.result.size); |
---|
| 49 | jQuery(row).removeClass("nothumb"); |
---|
[10571] | 50 | } else { |
---|
| 51 | jQuery(row).find('td.thumbdim').html('#ERR#'+data.err+"# : "+data.message); |
---|
[10570] | 52 | jQuery(row).removeClass("nothumb"); |
---|
| 53 | jQuery(row).addClass("error"); |
---|
[10571] | 54 | } |
---|
| 55 | } |
---|
[10570] | 56 | })(td) |
---|
[10571] | 57 | }); |
---|
| 58 | }); |
---|
[10570] | 59 | } |
---|
| 60 | |
---|
| 61 | function toggleCropFields() { |
---|
| 62 | if (jQuery("#thumb_crop").is(':checked')) { |
---|
| 63 | jQuery("label[for='thumb_maxwidth']").text(width_str); |
---|
| 64 | jQuery("label[for='thumb_maxheight']").text(height_str); |
---|
| 65 | jQuery("#thumb_follow_orientation_li").show(); |
---|
| 66 | } |
---|
| 67 | else { |
---|
| 68 | jQuery("label[for='thumb_maxwidth']").text(max_width_str); |
---|
| 69 | jQuery("label[for='thumb_maxheight']").text(max_height_str); |
---|
| 70 | jQuery("#thumb_follow_orientation_li").hide(); |
---|
| 71 | } |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | jQuery(document).ready(function(){ |
---|
| 75 | jQuery('input#proceed').click (function () { |
---|
| 76 | var width = jQuery('input[name="thumb_maxwidth"]').val(); |
---|
| 77 | var height = jQuery('input[name="thumb_maxheight"]').val(); |
---|
[10571] | 78 | var crop = jQuery('#thumb_crop').is(':checked'); |
---|
| 79 | var follow_orientation = jQuery('#thumb_follow_orientation').is(':checked'); |
---|
[10570] | 80 | jQuery(".waiting_bar").toggle(); |
---|
| 81 | if (todo < 200) |
---|
| 82 | jQuery('.thumbpic').show(); |
---|
| 83 | jQuery('.thumbgentime, .thumbsize, .thumbdim').show(); |
---|
| 84 | processThumbs(width,height,crop,follow_orientation); |
---|
| 85 | }); |
---|
| 86 | |
---|
| 87 | toggleCropFields(); |
---|
| 88 | jQuery("#thumb_crop").click(function () {toggleCropFields()}); |
---|
| 89 | |
---|
| 90 | jQuery('.thumbpic, .thumbgentime, .thumbsize, .thumbdim').hide(); |
---|
| 91 | }); |
---|
| 92 | {/literal}{/footer_script} |
---|
| 93 | |
---|
[2531] | 94 | <div class="titrePage"> |
---|
[5021] | 95 | <h2>{'Thumbnail creation'|@translate}</h2> |
---|
[2531] | 96 | </div> |
---|
| 97 | |
---|
[10570] | 98 | {if !empty($remainings) } |
---|
[2531] | 99 | <form method="post" action="{$params.F_ACTION}" class="properties"> |
---|
| 100 | |
---|
| 101 | <fieldset> |
---|
[10570] | 102 | <legend>{'Thumbnail creation'|@translate}</legend> |
---|
[2531] | 103 | |
---|
| 104 | <ul> |
---|
| 105 | <li> |
---|
[10570] | 106 | <span class="property"><label for="thumb_crop">{'Crop'|@translate}</label></span> |
---|
[10571] | 107 | <input type="checkbox" name="thumb_crop" id="thumb_crop" {$values.thumb_crop}> |
---|
[2531] | 108 | </li> |
---|
[10570] | 109 | <li id="thumb_follow_orientation_li"> |
---|
| 110 | <span class="property"><label for="thumb_follow_orientation">{'Follow Orientation'|@translate}</label></span> |
---|
[10571] | 111 | <input type="checkbox" name="thumb_follow_orientation" id="thumb_follow_orientation" {$values.thumb_follow_orientation}> |
---|
[10570] | 112 | </li> |
---|
[2531] | 113 | <li> |
---|
[10570] | 114 | <span class="property"><label for="thumb_maxwidth">{'Maximum Width'|@translate}</label></span> |
---|
[10571] | 115 | <input type="text" name="thumb_maxwidth" id="thumb_maxwidth" value="{$values.thumb_maxwidth}" size="4" maxlength="4"> {'pixels'|@translate} |
---|
[2531] | 116 | </li> |
---|
| 117 | <li> |
---|
[10570] | 118 | <span class="property"><label for="thumb_maxheight">{'Maximum Height'|@translate}</label></span> |
---|
[10571] | 119 | <input type="text" name="thumb_maxheight" id="thumb_maxheight" value="{$values.thumb_maxheight}" size="4" maxlength="4"> {'pixels'|@translate} |
---|
[2531] | 120 | </li> |
---|
| 121 | <li> |
---|
[10570] | 122 | <span class="property"><label for="thumb_quality">{'Image Quality'|@translate}</label></span> |
---|
[10571] | 123 | <input type="text" name="thumb_quality" id="thumb_quality" value="{$values.thumb_quality}" size="3" maxlength="3"> % |
---|
[2531] | 124 | </li> |
---|
| 125 | </ul> |
---|
| 126 | </fieldset> |
---|
| 127 | |
---|
[10570] | 128 | <p class="waiting_bar"><input type="button" name="submit" id="proceed" value="{'Submit'|@translate}"></p> |
---|
| 129 | <p class="waiting_bar" style="display:none;">{'Please wait...'|@translate}<br><img src="admin/themes/default/images/ajax-loader-bar.gif"></p> |
---|
[2531] | 130 | </form> |
---|
| 131 | |
---|
[10570] | 132 | <div class="admin"><span id="thumb_remaining">{$TOTAL_NB_REMAINING} {'photos without thumbnail (jpeg and png only)'|@translate}</span></div> |
---|
[2531] | 133 | <table style="width:100%;"> |
---|
| 134 | <tr class="throw"> |
---|
[10570] | 135 | <th> </th> |
---|
| 136 | <th style="width:60%;">{'Path'|@translate}</th> |
---|
| 137 | <th>{'Filesize'|@translate}</th> |
---|
| 138 | <th>{'Dimensions'|@translate}</th> |
---|
| 139 | <th class="thumbpic">{'Thumbnail'|@translate}</th> |
---|
| 140 | <th class="thumbgentime">{'generated in'|@translate}</th> |
---|
| 141 | <th class="thumbsize">{'Filesize'|@translate}</th> |
---|
| 142 | <th class="thumbdim">{'Dimensions'|@translate}</th> |
---|
[2531] | 143 | </tr> |
---|
| 144 | {foreach from=$remainings item=elt name=remain_loop} |
---|
[10570] | 145 | <tr class="{if $smarty.foreach.remain_loop.index is odd}row1{else}row2{/if} nothumb item" id="th_{$smarty.foreach.remain_loop.iteration}"> |
---|
[2531] | 146 | <td>{$smarty.foreach.remain_loop.iteration}</td> |
---|
[10570] | 147 | <td class="filepath">{$elt.PATH}</td> |
---|
| 148 | <td>{$elt.FILESIZE_IMG}</td> |
---|
| 149 | <td>{$elt.WIDTH_IMG} x {$elt.HEIGHT_IMG}</td> |
---|
[10571] | 150 | <td class="thumbpic"><img src="admin/themes/default/images/ajax-loader.gif"></td> |
---|
| 151 | <td class="thumbgentime"> </td> |
---|
| 152 | <td class="thumbsize"> </td> |
---|
| 153 | <td class="thumbdim"> </td> |
---|
[2531] | 154 | </tr> |
---|
| 155 | {/foreach} |
---|
| 156 | </table> |
---|
| 157 | {else} |
---|
[10571] | 158 | <p style="text-align:left;margin:20px;"> |
---|
| 159 | <b>{'No missing thumbnail'|@translate}</b><br><br> |
---|
| 160 | {'If you want to regenerate thumbnails, please go to the <a href="%s">Batch Manager</a>.'|@translate|@sprintf:"admin.php?page=batch_manager"} |
---|
| 161 | </p> |
---|
[10570] | 162 | {/if} |
---|