Changeset 6210
- Timestamp:
- May 17, 2010, 8:36:54 PM (14 years ago)
- Location:
- extensions/ColorStat
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/ColorStat/admin/cstat_config.tpl
r6176 r6210 45 45 break; 46 46 } 47 48 47 } 49 48 … … 53 52 $("#icstat_stat_minPct_slider").slider( 54 53 { 55 min:0. 5,54 min:0.25, 56 55 max:60, 57 56 step:0.25, … … 60 59 }); 61 60 $("#icstat_stat_minPct_slider a").addClass('gcBgInput'); 61 62 formatPx({/literal}{$datas.colorSize}{literal}); 63 $("#icstat_display_colorSize_slider").slider( 64 { 65 min:5, 66 max:25, 67 step:1, 68 value:{/literal}{$datas.colorSize}{literal}, 69 slide: function(event, ui) { formatPx(ui.value); } 70 }); 71 $("#icstat_display_colorSize_slider a").addClass('gcBgInput'); 72 73 showColors(); 74 qi.calculateTimes(); 62 75 displayConfig('database'); 76 } 77 78 function formatPx(px) 79 { 80 $("#icstat_display_colorSize").val(px); 81 $("#icstat_display_colorSize_display").html(px+"px"); 63 82 } 64 83 … … 68 87 $("#icstat_stat_minPct_display").html(pct.toFixed(2)+"%"); 69 88 } 89 90 function showColors() 91 { 92 if($('#idisplay_gallery_showColorsCBox').get(0).checked) 93 { 94 $('#idisplay_gallery_showColors').val('y'); 95 $('#icstat_display_colorSize_area').css('display', 'block'); 96 } 97 else 98 { 99 $('#idisplay_gallery_showColors').val('n'); 100 $('#icstat_display_colorSize_area').css('display', 'none'); 101 } 102 } 103 104 105 qualityInterface = function(optionsToSet) 106 { 107 var qualityValues = [{/literal}{$datas.qualityHighest}, {$datas.qualityHigh}, {$datas.qualityNormal}, {$datas.qualityLow}, {$datas.qualityLowest}{literal}]; 108 var qualityKeys = ['highest', 'hight', 'normal', 'low', 'lowest']; 109 110 var options = jQuery.extend( 111 { 112 pps:0, 113 }, 114 optionsToSet); 115 116 117 this.calculateTimes = function () 118 { 119 _calculateTimes(); 120 } 121 122 var _calculateTimes = function () 123 { 124 values=new Array(); 125 126 for(i=0;i<qualityValues.length;i++) 127 { 128 if(options.pps==0) 129 { 130 values[i]=Array('-', '-'); 131 } 132 else 133 { 134 values[i]=Array( 135 (qualityValues[i]/options.pps).toFixed(2)+'s', 136 formatTime({/literal}{$datas.nbPictures}{literal}*qualityValues[i]/options.pps) 137 ); 138 } 139 } 140 141 $('#iEstimatedHighest').html(values[0][0]); 142 $('#iEstimatedHighestAll').html(values[0][1]); 143 144 $('#iEstimatedHigh').html(values[1][0]); 145 $('#iEstimatedHighAll').html(values[1][1]); 146 147 $('#iEstimatedNormal').html(values[2][0]); 148 $('#iEstimatedNormalAll').html(values[2][1]); 149 150 $('#iEstimatedLow').html(values[3][0]); 151 $('#iEstimatedLowAll').html(values[3][1]); 152 153 $('#iEstimatedLowest').html(values[4][0]); 154 $('#iEstimatedLowestAll').html(values[4][1]); 155 } 156 157 158 159 this.doRequest = function () 160 { 161 displayBench(true); 162 $.ajax( 163 { 164 type: "POST", 165 url: "{/literal}{$datas.urlRequest}{literal}", 166 async: true, 167 data: { ajaxfct:"doPpsBench", quality:2 }, 168 success: function(msg) 169 { 170 options.pps=msg; 171 _calculateTimes(); 172 displayBench(false); 173 }, 174 } 175 ); 176 } 177 178 var formatTime = function (eTime) 179 { 180 var seconds=(eTime%60).toFixed(2); 181 var minutes=((eTime-seconds)/60).toFixed(0); 182 var returned=seconds+"s"; 183 if(minutes>0) returned=minutes+"m"+returned; 184 return(returned); 185 } 186 187 var displayBench = function (processing) 188 { 189 if(processing) 190 { 191 $('#iBenchBtn').css('display', 'none'); 192 $('#iBenchWait').css('display', 'block'); 193 } 194 else 195 { 196 $('#iBenchBtn').css('display', 'block'); 197 $('#iBenchWait').css('display', 'none'); 198 } 199 } 200 } 201 202 var qi=new qualityInterface({pps:{/literal}{$datas.pps}{literal}}); 203 70 204 </script> 71 205 {/literal} … … 79 213 <div id='iDisplayConfigDatabase' style='display:none;'> 80 214 215 <fieldset> 216 <legend>{'cstat_bench'|@translate}</legend> 217 <div>{'cstat_do_benchmark'|@translate}</div> 218 <br> 219 <div id='iBenchBtn'> 220 <input type="button" onclick="qi.doRequest();" value="{'cstat_do_bench'|@translate}"> 221 </div> 222 <div id='iBenchWait' style='display:none;text-align:center;'> 223 <img src='./plugins/GrumPluginClasses/icons/processing.gif'> 224 </div> 225 </fieldset> 226 227 <fieldset> 228 <legend>{'cstat_quality_of_analyze'|@translate}</legend> 229 230 <table class="formtable table2"> 231 <tr class='throw'> 232 <td>{'cstat_quality_level'|@translate}</td> 233 <td>{'cstat_estimated_time_one_picture'|@translate}</td> 234 <td>{'cstat_estimated_time_all_pictures'|@translate}</td> 235 </tr> 236 <tr> 237 <td> 238 <label><input type="radio" name="f_analyze_ppsQuality" value="{$datas.qualityHighest}" {if $datas.quality==$datas.qualityHighest}checked{/if}> {'cstat_quality_highest'|@translate}</label> 239 </td> 240 <td class='estimatedTime'> 241 <span id='iEstimatedHighest'>-</span> 242 </td> 243 <td class='estimatedTime'> 244 <span id='iEstimatedHighestAll'>-</span> 245 </td> 246 </tr> 247 <tr> 248 <td> 249 <label><input type="radio" name="f_analyze_ppsQuality" value="{$datas.qualityHigh}" {if $datas.quality==$datas.qualityHigh}checked{/if}> {'cstat_quality_high'|@translate}</label> 250 </td> 251 <td class='estimatedTime'> 252 <span id='iEstimatedHigh'>-</span> 253 </td> 254 <td class='estimatedTime'> 255 <span id='iEstimatedHighAll'>-</span> 256 </td> 257 </tr> 258 <tr> 259 <td> 260 <label><input type="radio" name="f_analyze_ppsQuality" value="{$datas.qualityNormal}" {if $datas.quality==$datas.qualityNormal}checked{/if}> {'cstat_quality_normal'|@translate}</label> 261 </td> 262 <td class='estimatedTime'> 263 <span id='iEstimatedNormal'>-</span> 264 </td> 265 <td class='estimatedTime'> 266 <span id='iEstimatedNormalAll'>-</span> 267 </td> 268 </tr> 269 <tr> 270 <td> 271 <label><input type="radio" name="f_analyze_ppsQuality" value="{$datas.qualityLow}" {if $datas.quality==$datas.qualityLow}checked{/if}> {'cstat_quality_low'|@translate}</label> 272 </td> 273 <td class='estimatedTime'> 274 <span id='iEstimatedLow'>-</span> 275 </td> 276 <td class='estimatedTime'> 277 <span id='iEstimatedLowAll'>-</span> 278 </td> 279 </tr> 280 <tr> 281 <td> 282 <label><input type="radio" name="f_analyze_ppsQuality" value="{$datas.qualityLowest}" {if $datas.quality==$datas.qualityLowest}checked{/if}> {'cstat_quality_lowest'|@translate}</label> 283 </td> 284 <td class='estimatedTime'> 285 <span id='iEstimatedLowest'>-</span> 286 </td> 287 <td class='estimatedTime'> 288 <span id='iEstimatedLowestAll'>-</span> 289 </td> 290 </tr> 291 </table> 292 293 294 295 296 297 </fieldset> 81 298 </div> 82 299 83 300 <div id='iDisplayConfigStatSearch' style='display:none;'> 84 301 <fieldset> 85 <legend>{'cstat_s tat_and_search'|@translate}</legend>302 <legend>{'cstat_significant_colors'|@translate}</legend> 86 303 87 304 <table class="formtable"> … … 104 321 <div id='iDisplayConfigDisplay' style='display:none;'> 105 322 <fieldset> 106 <legend>{'cstat_gallery_ integration'|@translate}</legend>323 <legend>{'cstat_gallery_display_colors'|@translate}</legend> 107 324 108 325 <label> 109 <input type="checkbox" id='idisplay_gallery_showColorsCBox' onclick=" $('#idisplay_gallery_showColors').val(($('#idisplay_gallery_showColorsCBox').get(0).checked=='on')?'y':'n');"{if $datas.showColors=='y'}checked{/if} >326 <input type="checkbox" id='idisplay_gallery_showColorsCBox' onclick="showColors();" {if $datas.showColors=='y'}checked{/if} > 110 327 {'cstat_display_colors_on_image'|@translate} 111 328 <input type="hidden" id='idisplay_gallery_showColors' name='f_display_gallery_showColors' value='{$datas.showColors}'> 112 329 </label> 113 330 331 <div id='icstat_display_colorSize_area'> 332 <br> 333 <table class="formtable"> 334 <tr> 335 <td colspan="2">{'cstat_color_size'|@translate}</td> 336 </tr> 337 <tr> 338 <td> 339 <input type="hidden" name="f_display_gallery_colorSize" id="icstat_display_colorSize" value="{$datas.colorSize}"> 340 <div id="icstat_display_colorSize_slider" class="gcBgInput gcBorderInput"></div> 341 </td> 342 <td width="90px"> 343 <div id="icstat_display_colorSize_display"></div> 344 </td> 345 </tr> 346 </table> 347 </div> 348 114 349 </fieldset> 115 350 </div> -
extensions/ColorStat/admin/cstat_database.tpl
r6107 r6210 119 119 if(processAnalyze.step < processAnalyze.lists.length) 120 120 { 121 tmp =$.ajax(121 $.ajax( 122 122 { 123 123 type: "POST", -
extensions/ColorStat/cstat.css
r6176 r6210 44 44 .color0px { border-spacing:0px; } 45 45 46 .estimatedTime { text-align:right; } -
extensions/ColorStat/cstat_aip.class.inc.php
r6176 r6210 138 138 $result=$this->ajax_cstat_showStatsGetListColors($_REQUEST['orderType']); 139 139 break; 140 case 'doPpsBench': 141 $result=$this->ajax_cstat_ppsBench($_REQUEST['quality'], true); 142 break; 140 143 } 141 144 GPCAjax::returnResult($result); … … 188 191 } 189 192 190 } 191 193 194 if($_REQUEST['ajaxfct']=='doPpsBench') 195 { 196 if(!isset($_REQUEST['quality'])) $_REQUEST['quality']=8; 197 if($_REQUEST['quality']>50 or $_REQUEST['quality']<1) $_REQUEST['quality']=8; 198 } 199 } 192 200 193 201 } … … 309 317 dirname($this->getFileLocation()).'/admin/cstat_config.tpl'); 310 318 319 $nbPictures=0; 320 $sql="SELECT COUNT(image_id) FROM ".$this->tables['images']; 321 $result=pwg_query($sql); 322 if($result) 323 { 324 while($row=pwg_db_fetch_row($result)) 325 { 326 $nbPictures=$row[0]; 327 } 328 } 329 330 311 331 $datas=Array( 332 'nbPictures' => $nbPictures, 333 'pps' => $this->config['analyze_pps'], 334 'quality' => $this->config['analyze_ppsQuality'], 335 'qualityHighest' => 14000, 336 'qualityHigh' => 7500, 337 'qualityNormal' => 3500, 338 'qualityLow' => 1200, 339 'qualityLowest' => 600, 340 'urlRequest' => $this->getAdminLink(), 312 341 'minPct' => $this->config['stat_minPct'], 313 'showColors' => $this->config['display_gallery_showColors'] 342 'showColors' => $this->config['display_gallery_showColors'], 343 'colorSize' => $this->config['display_gallery_colorSize'], 314 344 ); 315 345 … … 349 379 $colorTable, 350 380 Array( 351 'quality' => 8, 352 'numColors' => 16, 353 'maxTime' => $this->config['analyze_maxTime'], 354 'pps' => $this->config['analyze_pps'], 381 'mode' => 'numAnalyzed', 382 'numColors' => 24, 383 'numAnalyzed' => $this->config['analyze_ppsQuality'], 355 384 ) 356 385 ); -
extensions/ColorStat/cstat_colorstat.class.inc.php
r6176 r6210 356 356 $imageHeight=imagesy($image); 357 357 358 if($options['pps']>0 && $options['maxTime']>0) 358 if($options['mode']=='numAnalyzed') 359 { 360 $quality=round(sqrt($imageWidth*$imageHeight/$options['numAnalyzed']), 0); 361 } 362 elseif($options['mode']=='maxTime') 359 363 { 360 364 $quality=round(sqrt($imageWidth*$imageHeight/($options['pps']*$options['maxTime'])), 0); … … 679 683 680 684 if(!array_key_exists('quality', $options)) $options['quality']=1; 681 if(!array_key_exists('maxTime', $options)) $options['maxTime']=0; 682 if(!array_key_exists('pps', $options)) $options['pps']=0; 685 if(!array_key_exists('maxTime', $options)) $options['maxTime']=0.5; 686 if(!array_key_exists('pps', $options)) $options['pps']=1; 687 if(!array_key_exists('numAnalyzed', $options)) $options['numAnalyzed']=600; 683 688 if(!array_key_exists('numColors', $options)) $options['numColors']=0; 689 if(!array_key_exists('mode', $options)) $options['mode']='quality'; 684 690 685 691 if($options['quality']<=0) $options['quality']=1; 686 692 if($options['quality']>20) $options['quality']=20; 687 if($options['maxTime']<0) $options['maxTime']=0; 688 if($options['pps']<0) $options['pps']=0; 689 if($options['numColors']<0) $options['numColors']=0; 693 if($options['maxTime']<0) $options['maxTime']=0.5; 694 if($options['pps']<0) $options['pps']=1; 695 if($options['numAnalyzed']<0) $options['numAnalyzed']=600; 696 if($options['numColors']<0) $options['numColors']=16; 697 698 if($options['mode']!='quality' and 699 $options['mode']!='numAnalyzed' and 700 $options['mode']!='maxTime') $options['mode']='quality'; 690 701 691 702 return($options); -
extensions/ColorStat/cstat_rb_callback.class.inc.php
r6176 r6210 152 152 'id' => $id, 153 153 'class' => $class, 154 'br' => ' /',154 'br' => '<br>', 155 155 ); 156 156 -
extensions/ColorStat/cstat_root.class.inc.php
r6176 r6210 74 74 'analyze_colorTable' => 'small', 75 75 'analyze_pps' => 0, 76 'analyze_ppsQuality' => 7500, 76 77 'analyze_itemPerRequest' => 10, 77 78 'display_gallery_showColors' => 'n', 79 'display_gallery_colorSize' => 15, 78 80 'display_stat_orderType' => 'img', 79 81 'stat_minPct' => 1.5, … … 85 87 --------------------------------------------------------------------------- */ 86 88 89 /** 90 * this function return the number of pixels analyzed per second for an image 91 * 92 * @param Integer $quality : quality used to analyze the performance 93 * a quality of 1 is the best quality (process is 94 * longuer so, analyze is better) 95 * @param Boolean $update : if yes, update the config with the current pps 96 * @return Integer : pps 97 */ 98 protected function ajax_cstat_ppsBench($quality, $update) 99 { 100 ColorStat::getFileColors( 101 dirname($this->getFileLocation()).'/image/sample1.png', 102 ColorStat::getColorTable(CStat_root::$colorTableSize['small'][0],CStat_root::$colorTableSize['small'][1]), 103 Array('quality' => $quality, 'numColors' => 16) 104 ); 105 106 if($update) 107 { 108 $this->config['analyze_pps']=ColorStat::$fileColorsStat['pps']; 109 $this->saveConfig(); 110 } 111 112 return(ColorStat::$fileColorsStat['pps']); 113 } 87 114 88 115 } //class -
extensions/ColorStat/cstat_version.inc.php
r5961 r6210 15 15 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 16 16 17 define('CSTAT_VERSION', ' 0.1.0');18 define('CSTAT_VERSION2', '0 0.01.00');17 define('CSTAT_VERSION', '1.0.0'); 18 define('CSTAT_VERSION2', '01.00.00'); 19 19 ?> -
extensions/ColorStat/language/en_UK/plugin.lang.php
r6107 r6210 66 66 67 67 68 68 69 $lang['cstat_search']='Search'; 69 70 $lang['cstat_search_by_color']='Search by color'; 70 $lang['cstat_choose_colors']='Sélection de couleurs'; 71 $lang['cstat_choosen_colors']='Couleurs sélectionnées'; 72 $lang['cstat_operator_and']="Toutes les couleurs sélectionnées doivent être présentes dans l'image"; 73 $lang['cstat_operator_or']="Au moins une des couleurs sélectionnées doit être présente dans l'image"; 74 $lang['cstat_operator_not']="Aucune des couleurs sélectionnées ne doit être présente dans l'image'"; 75 $lang['cstat_color_already_choosen']='La couleur est déjà sélectionnée dans la liste'; 76 $lang['cstat_add_colors']='Ajouter une sélection de couleurs'; 77 $lang['cstat_clear_colors']='Réinitialiser les critères'; 78 $lang['cstat_do_modify_request']='Modifier la recherche'; 79 $lang['cstat_search_criterion'] = 'Critères de recherche'; 71 $lang['cstat_choose_colors']='Panel of colors'; 72 $lang['cstat_choosen_colors']='Selected colors'; 73 $lang['cstat_operator_and']="All selected colors must be present in the pictures"; 74 $lang['cstat_operator_or']="At least one selected colors must be present in the pictures"; 75 $lang['cstat_operator_not']="None of the selected colors should be present in the image"; 76 $lang['cstat_color_already_choosen']='The color is already selected in the list'; 77 $lang['cstat_add_colors']='Add a selection of colors'; 80 78 81 79 82 80 $lang['cstat_config']='Configuration'; 81 $lang['cstat_gallery_integration']='Gallery integration'; 82 $lang['cstat_apply']='Apply'; 83 $lang['cstat_stat_and_search']='Statistics & Research'; 84 $lang['cstat_save_config']='Configuration is saved'; 85 $lang['cstat_display_colors_on_image']='View colors associated with the image'; 86 $lang['cstat_percent_min_significant']='Minimum presence in an image to consider a color is relevant in a search:'; 87 $lang['cstat_config_plugin']='Configuring the plugin'; 88 $lang['cstat_gallery_display_colors'] = 'Display colors of image'; 89 $lang['cstat_color_size'] = 'Dimensions'; 90 $lang['cstat_significant_colors'] = 'Relevance colors'; 91 $lang['cstat_bench'] = 'Measuring performance'; 92 $lang['cstat_do_bench'] = 'Measure'; 93 $lang['cstat_do_benchmark'] = "Depending on server performance, analysis of images of the gallery can be more or less long. <br> 94 It is possible to adjust the plugin to emphasize the speed of analysis at the expense of quality, or conversely, focusing on the quality of analysis at the expense of speed. <br> 83 95 84 $lang['cstat_config_plugin']='Configuring the plugin'; 96 The measure reflects performance computing capabilities at a given time, which may vary depending on server load: the estimated time of treatment is indicative only and vary slightly depending on available resources. 97 "; 98 $lang['cstat_quality_of_analyze'] = 'Quality analysis'; 99 $lang['cstat_quality_level']='Quality'; 100 $lang['cstat_estimated_time_one_picture']='Estimated time for an image'; 101 $lang['cstat_estimated_time_all_pictures']='Estimated time for all images'; 102 $lang['cstat_quality_highest']='Very high'; 103 $lang['cstat_quality_high']='High'; 104 $lang['cstat_quality_normal']='Normal'; 105 $lang['cstat_quality_low']='Low'; 106 $lang['cstat_quality_lowest']='Very low'; 107 108 $lang['cstat_colors_on_image']='Colors associated with the image'; 85 109 86 110 ?> -
extensions/ColorStat/language/fr_FR/plugin.lang.php
r6176 r6210 76 76 $lang['cstat_operator_and']="Toutes les couleurs sélectionnées doivent être présentes dans l'image"; 77 77 $lang['cstat_operator_or']="Au moins une des couleurs sélectionnées doit être présente dans l'image"; 78 $lang['cstat_operator_not']="Aucune des couleurs sélectionnées ne doit être présente dans l'image '";78 $lang['cstat_operator_not']="Aucune des couleurs sélectionnées ne doit être présente dans l'image"; 79 79 $lang['cstat_color_already_choosen']='La couleur est déjà sélectionnée dans la liste'; 80 80 $lang['cstat_add_colors']='Ajouter une sélection de couleurs'; … … 88 88 $lang['cstat_display_colors_on_image']='Afficher les couleurs associées à l\'image'; 89 89 $lang['cstat_percent_min_significant']='Présence minimum au sein d\'une image pour qu\'une couleur soit considérée comme pertinente lors d\'une recherche :'; 90 $lang['cstat_config_plugin']='Configuration du plugin'; 91 $lang['cstat_gallery_display_colors'] = 'Affichage des couleurs de l\'image'; 92 $lang['cstat_color_size'] = 'Dimensions'; 93 $lang['cstat_significant_colors'] = 'Pertinence des couleurs'; 94 $lang['cstat_bench'] = 'Mesure des performances'; 95 $lang['cstat_do_bench'] = 'Mesurer'; 96 $lang['cstat_do_benchmark'] = "En fonction des performances du serveur, l'analyse des images de la galerie peut être plus ou moins longue.<br> 97 Il est possible de régler le plugin afin de privilégier la rapidité de l'analyse au détriment de la qualité, ou inversement, privilégier la qualité de l'analyse au détriment de la rapidité.<br><br> 90 98 91 $lang['cstat_config_plugin']='Configuration du plugin'; 99 La mesure des performances reflète les capacités de calcul à un instant donné, lesquelles peuvent varier en fonction de la charge du serveur : le temps estimé des traitements n'est donné qu'à titre indicatif et peu donc varier en fonction des ressources disponibles. 100 "; 101 $lang['cstat_quality_of_analyze'] = 'Qualité de l\'analyse'; 102 $lang['cstat_quality_level']='Qualité'; 103 $lang['cstat_estimated_time_one_picture']='Temps estimé pour une image'; 104 $lang['cstat_estimated_time_all_pictures']='Temps estimé pour toutes les images'; 105 $lang['cstat_quality_highest']='Très haute'; 106 $lang['cstat_quality_high']='Haute'; 107 $lang['cstat_quality_normal']='Normale'; 108 $lang['cstat_quality_low']='Basse'; 109 $lang['cstat_quality_lowest']='Très basse'; 92 110 93 111 $lang['cstat_colors_on_image']='Couleurs associées à l\'image'; -
extensions/ColorStat/main.inc.php
r6176 r6210 2 2 /* 3 3 Plugin Name: ColorStat 4 Version: 0.1.04 Version: 1.0.0 5 5 Description: Allow to make stat on pictures colors 6 Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid= 6 Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=393 7 7 Author: grum@piwigo.org 8 8 Author URI: http://photos.grum.fr … … 24 24 | 0.1.0 | 2010/04/21 | start to coding 25 25 | | | 26 | | |26 | 1.0.0 | 2010/05/17 | first release for PEM 27 27 | | | 28 28 | | | … … 87 87 //CStat public interface loaded and active only if in public page 88 88 include_once("cstat_pip.class.inc.php"); 89 CStat_functions::init($prefixeTable); 89 90 $obj=new CStat_PIP($prefixeTable, __FILE__); 90 91 set_plugin_data($plugin['id'], $obj);
Note: See TracChangeset
for help on using the changeset viewer.