Changeset 8226
- Timestamp:
- Dec 22, 2010, 1:01:25 PM (13 years ago)
- Location:
- extensions/PHP_Optimisateur
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/PHP_Optimisateur/config.xml
r8195 r8226 3 3 <DIRsource>./in/</DIRsource> 4 4 <DIRsortie>./out/</DIRsortie> 5 <silentORNOT> false</silentORNOT>6 <DIRhighORNOT>true</DIRhighORNOT> 7 <DIMhdORNOT>true</DIMhdORNOT> 8 <renameORNOT>true</renameORNOT> 9 <indexORNOT>true</indexORNOT> 10 <prefixe_mini>TN-</prefixe_mini> 11 <DIMhd>2560</DIMhd> 12 <DIMnormal>800</DIMnormal> 13 <DIMthumbnail>120</DIMthumbnail> 5 <silentORNOT>block</silentORNOT> 6 <DIRhighORNOT>true</DIRhighORNOT> 7 <DIMhdORNOT>true</DIMhdORNOT> 8 <renameORNOT>true</renameORNOT> 9 <indexORNOT>true</indexORNOT> 10 <prefixe_mini>TN-</prefixe_mini> 11 <DIMhd>2560</DIMhd> 12 <DIMnormal>800</DIMnormal> 13 <DIMthumbnail>120</DIMthumbnail> 14 14 <Qhd>100</Qhd> 15 <Qnormal>80</Qnormal> 16 <Qthumbnail>80</Qthumbnail> 17 <DPI>72</DPI> 18 <copyright>© 2010</copyright> 19 <copyONhd>false</copyONhd> 20 <copyONnormal>false</copyONnormal> 21 <copyPOS>bottom-right</copyPOS> 22 <copySIZE>0.05</copySIZE> 23 <copyCOLOR> 000 000 000</copyCOLOR>15 <Qnormal>80</Qnormal> 16 <Qthumbnail>80</Qthumbnail> 17 <DPI>72</DPI> 18 <copyright>© 2010</copyright> 19 <copyONhd>false</copyONhd> 20 <copyONnormal>false</copyONnormal> 21 <copyPOS>bottom-right</copyPOS> 22 <copySIZE>0.05</copySIZE> 23 <copyCOLOR>#000000</copyCOLOR> 24 24 <copyFONT>Arial</copyFONT> 25 25 <PluginsBefore></PluginsBefore> -
extensions/PHP_Optimisateur/files/display_config.php
r8195 r8226 109 109 <tr> 110 110 <td><b>'.l10n('copyCOLOR').' :</b></td> 111 <td> rgb('.$copyCOLOR.') <span style="vertical-align:middle;border:1px solid #7f7f7f;width:1.5em;height:0.8em;display:inline-block;background:rgb('.str_replace(' ',',',$copyCOLOR).');"> </span></td>111 <td>'.$copyCOLOR.' <span style="vertical-align:middle;border:1px solid #7f7f7f;width:1.5em;height:0.8em;display:inline-block;background:'.$copyCOLOR.';"> </span></td> 112 112 </tr> 113 113 <tr> -
extensions/PHP_Optimisateur/files/functions.php
r8195 r8226 5 5 \***************************************/ 6 6 7 // Affiche les textes 7 // Affiche les textes localisés 8 8 function l10n($code){ 9 9 global $Lang; … … 21 21 } 22 22 23 // Trouve la langue 23 // Trouve la langue, retourne la langue de l'utilisateur et les langues installées 24 24 function GetLanguage(){ 25 25 // tableau avec les langues installées … … 64 64 } else { 65 65 return true; 66 67 66 } 68 67 } … … 70 69 // Supprime un repertoire non-vide 71 70 function rrmdir($dir) { 71 $dir = rtrim($dir, '/'); 72 72 if (is_dir($dir)) { 73 73 $objects = scandir($dir); … … 159 159 } else if (preg_match('#^([0-9]*)$#', $value)) { 160 160 settype($array[$key], 'int'); 161 } else if (preg_match('#^([0-9]*)( .|,)([0-9]*)$#', $value)) {161 } else if (preg_match('#^([0-9]*)(\.|,)([0-9]*)$#', $value)) { 162 162 settype($array[$key], 'float'); 163 163 } … … 171 171 function bool_to_string($bool, $just_echo=0) { 172 172 global $Lang; 173 # $just_echo pour pouvoir afficher un booléen tel quel 173 # $just_echo pour pouvoir afficher un booléen tel quel (echo true; n'affiche rien) 174 174 if (is_bool($bool)) { 175 175 if ($bool) { … … 184 184 } 185 185 } 186 187 // Converti une chaine de config et tableau associatif 188 function ExplodeString($string, $sep1=';', $sep2=':') { 189 $result = array(); 190 $a = explode($sep1, $string); 191 foreach ($a as $s) { 192 $v = explode($sep2, $s); 193 $result[$v[0]] = $v[1]; 194 } 195 return $result; 196 } 197 198 // Converti une couleur HEX et RGB 199 function hex2RGB($hexStr, $returnAsString = false, $seperator = ',') { 200 $hexStr = preg_replace("/[^0-9A-Fa-f]/", '', $hexStr); // Gets a proper hex string 201 $rgbArray = array(); 202 203 if (strlen($hexStr) == 6) { //If a proper hex code, convert using bitwise operation. No overhead... faster 204 $colorVal = hexdec($hexStr); 205 $rgbArray['r'] = 0xFF & ($colorVal >> 0x10); 206 $rgbArray['g'] = 0xFF & ($colorVal >> 0x8); 207 $rgbArray['b'] = 0xFF & $colorVal; 208 } elseif (strlen($hexStr) == 3) { //if shorthand notation, need some string manipulations 209 $rgbArray['r'] = hexdec(str_repeat(substr($hexStr, 0, 1), 2)); 210 $rgbArray['g'] = hexdec(str_repeat(substr($hexStr, 1, 1), 2)); 211 $rgbArray['b'] = hexdec(str_repeat(substr($hexStr, 2, 1), 2)); 212 } else { 213 return false; //Invalid hex color code 214 } 215 216 return $returnAsString ? implode($seperator, $rgbArray) : $rgbArray; // returns the rgb string or the associative array 217 } 186 218 ?> -
extensions/PHP_Optimisateur/files/index.php
r7988 r8226 1 1 <?php 2 2 $url = '../index.php'; 3 header( 'Request-URI: '.$url);4 header( 'Content-Location: '.$url);5 header( 'Location: '.$url);3 header('Request-URI: '.$url); 4 header('Content-Location: '.$url); 5 header('Location: '.$url); 6 6 exit(); 7 7 ?> -
extensions/PHP_Optimisateur/files/style.css
r8195 r8226 62 62 font-size:1.2em; 63 63 font-style:italic; 64 font-family:"Consolas"; 64 65 } 65 66 a:hover { -
extensions/PHP_Optimisateur/index.php
r8195 r8226 5 5 \***************************************/ 6 6 7 set_time_limit( 3600);7 set_time_limit(7200); 8 8 $TIME_START = microtime(true); 9 9 … … 89 89 ### Copyright & Options générales des conversion ### 90 90 $copyright = utf8_decode($copyright); 91 $copyCOLOR = hex2RGB(substr($copyCOLOR,1), true, ' '); 91 92 92 93 if ($copyONhd) { … … 125 126 // Découpe le nom de fichier : dossier/fichier 126 127 preg_match('#(.*)/(.*)$#', $FilesSortie[$i], $matches); 127 $FileFolder = $matches[1]; 128 $FileName = $matches[2]; 128 $FileFolder = $matches[1]; // dossier de sortie 129 $FileName = $matches[2]; // nom+ext fichier 129 130 130 131 // Crée les sous-dossiers de sortie & 'pwg_high' & 'thumbnail' … … 158 159 } 159 160 if (!isset($BlockThumbnail)) { 160 exec('files\nconvert.exe -q '.$Qthumbnail.' -out jpeg -o "'.$FileFolder.'/thumbnail/'.$prefixe_mini.$FileName.'" -dpi 72 '.$convOptions.' -resize '.$DIMthumbnail.' '.$DIMthumbnail.' -rmeta -rexifthumb"'.$FilesSource[$i].'"');161 exec('files\nconvert.exe -q '.$Qthumbnail.' -out jpeg -o "'.$FileFolder.'/thumbnail/'.$prefixe_mini.$FileName.'" -dpi 72 '.$convOptions.' -resize '.$DIMthumbnail.' '.$DIMthumbnail.' -rmeta -rexifthumb "'.$FilesSource[$i].'"'); 161 162 } 162 163 if (!isset($BlockHigh) AND $DIRhighORNOT) { -
extensions/PHP_Optimisateur/language/en/en.php
r8195 r8226 6 6 7 7 $Lang['ErrorFile'] = "Fatal error : Configuration file missing."; 8 $Lang['ErrorFolderIn'] = "Fatal error : Sourcefolder empty.";9 $Lang['ErrorFolderOut'] = "Fatal error : Exit folder not empty.";10 $Lang['ErrorNconvert'] = "The program nconvert.exe is unavailable.";11 $Lang['Source files'] = " Files";8 $Lang['ErrorFolderIn'] = "Fatal error : Input folder empty."; 9 $Lang['ErrorFolderOut'] = "Fatal error : Output folder not empty."; 10 $Lang['ErrorNconvert'] = "The program nconvert.exe is not found."; 11 $Lang['Source files'] = "Handled files"; 12 12 $Lang['%d files'] = "%d files"; 13 13 $Lang['Finish %d seconds'] = "Process done : %d seconds."; … … 18 18 $Lang['Configuration'] = "Configuration"; 19 19 $Lang['Folders'] = "Folders"; 20 $Lang['FolderIn'] = " Sourcefolder";21 $Lang['FolderOut'] = " Exit folder";20 $Lang['FolderIn'] = "Input folder"; 21 $Lang['FolderOut'] = "Output folder"; 22 22 $Lang['Options'] = "Options"; 23 $Lang['silentORNOT'] = "If exit folder not empty";23 $Lang['silentORNOT'] = "If output folder not empty"; 24 24 $Lang['DIRhighORNOT'] = "Create high-definition folders"; 25 25 $Lang['DIMhdORNOT'] = "Resize HD pictures"; … … 29 29 $Lang['Sizes and quality'] = "Sizes and quality"; 30 30 $Lang['DIMhd'] = "HD pictures max size"; 31 $Lang['DIMnormal'] = "Normal pictures size";31 $Lang['DIMnormal'] = "Normal pictures max size"; 32 32 $Lang['DIMthumbnail'] = "Thumbnails size"; 33 $Lang['Qhd'] = "HD pi stcures quality";33 $Lang['Qhd'] = "HD pictures quality"; 34 34 $Lang['Qnormal'] = "Normal pictures quality"; 35 35 $Lang['Qthumbnail'] = "Thumbails quality"; … … 59 59 $Lang['pass'] = "Continue"; 60 60 $Lang['block'] = "Block"; 61 $Lang['New !'] = " 62 $Lang['Missing !'] = " 61 $Lang['New !'] = "New !"; 62 $Lang['Missing !'] = "Missing !"; 63 63 $Lang['Reset'] = "Reset"; 64 $Lang['Valid'] = "Valid ";64 $Lang['Valid'] = "Validate"; 65 65 ?> -
extensions/PHP_Optimisateur/language/fr/fr.php
r8195 r8226 9 9 $Lang['ErrorFolderOut'] = "Erreur fatale : Dossier de sortie non vide."; 10 10 $Lang['ErrorNconvert'] = "Le programme nconvert.exe est introuvable."; 11 $Lang['Source files'] = "Fichiers ";11 $Lang['Source files'] = "Fichiers traités"; 12 12 $Lang['%d files'] = "%d fichiers"; 13 13 $Lang['Finish %d seconds'] = "Opération terminée : %d secondes."; … … 59 59 $Lang['pass'] = "Continuer"; 60 60 $Lang['block'] = "Bloquer"; 61 $Lang['New !'] = " 62 $Lang['Missing !'] = " 61 $Lang['New !'] = "Nouveau !"; 62 $Lang['Missing !'] = "Manquant !"; 63 63 $Lang['Reset'] = "Réinitialiser"; 64 64 $Lang['Valid'] = "Valider"; -
extensions/PHP_Optimisateur/plugins/convert_pan.xml
r7991 r8226 1 1 <convert_pan> 2 2 <mode>PluginsProcess</mode> 3 <active> true</active>3 <active>false</active> 4 4 <DIMpanorama>500</DIMpanorama> 5 5 <NAMEpanorama>_pan</NAMEpanorama> -
extensions/PHP_Optimisateur/plugins/create_custom_thumbs.php
r8195 r8226 2 2 /***************************************\ 3 3 | PHP OPTIMISATEUR | 4 | Plugin CreateCustomThumbs 1. 1|4 | Plugin CreateCustomThumbs 1.0 | 5 5 \***************************************/ 6 6 7 ## Crée des miniatures de taille fixe7 ## Différents traitements sur les miniatures : taille fixe & cadre (2 couleurs) 8 8 ## Dépend de la valeur de $DIMthumbnail 9 9 10 10 // CreateCustomThumbs à la priorité sur ConvertPan 11 11 if (isset($PluginsProcess['convert_pan']) OR !isset($BlockThumbnail)) { 12 13 $FileSource = $FilesSource[$i]; // fichier de travail 12 14 $DIMthumbnailV = $PluginsProcess['create_custom_thumbs']['DIMthumbnailV']; // Hauteur de l'image 13 $max = max($DIMthumbnail, $DIMthumbnailV); 15 $FRAMEparams = $PluginsProcess['create_custom_thumbs']['FRAMEparams']; // Paramètres du cadre 16 17 // Miniature de taille personnalisée 18 if ($DIMthumbnailV != '0') { 19 $max = max($DIMthumbnail, $DIMthumbnailV); 14 20 15 // on prend la miniature au milieu de l'image 16 if ($FileInfos['Height'] >= $FileInfos['Width']) { 17 $resize_param = $max.' 0'; 18 $tmp_x = $max; 19 $tmp_y = $max * $FileInfos['Height'] / $FileInfos['Width']; 20 } else { 21 $resize_param = '0 '.$max; 22 $tmp_x = $max * $FileInfos['Width'] / $FileInfos['Height']; 23 $tmp_y = $max; 21 // on prend la miniature au milieu de l'image 22 if ($FileInfos['Height'] >= $FileInfos['Width']) { 23 $resize_param = $max.' 0'; 24 $tmp_x = $max; 25 $tmp_y = $max * $FileInfos['Height'] / $FileInfos['Width']; 26 } else { 27 $resize_param = '0 '.$max; 28 $tmp_x = $max * $FileInfos['Width'] / $FileInfos['Height']; 29 $tmp_y = $max; 30 } 31 32 $offset_x = ($tmp_x - $DIMthumbnail) / 2; 33 $offset_y = ($tmp_y - $DIMthumbnailV) / 2; 34 35 exec('files\nconvert.exe -overwrite -q '.$Qthumbnail.' -out jpeg -o "'.$FileFolder.'/thumbnail/'.$prefixe_mini.$FileName.'" -dpi 72 '.$convOptions.' -resize '.$resize_param.' -crop '.$offset_x.' '.$offset_y.' '.$DIMthumbnail.' '.$DIMthumbnailV.' -rmeta -rexifthumb "'.$FileSource.'"'); 36 37 $BlockThumbnail = true; 38 $FileSource = $FileFolder.'/thumbnail/'.$prefixe_mini.$FileName; 24 39 } 25 26 $offset_x = ($tmp_x - $DIMthumbnail) / 2; 27 $offset_y = ($tmp_y - $DIMthumbnailV) / 2; 28 29 exec('files\nconvert.exe -overwrite -q '.$Qthumbnail.' -out jpeg -o "'.$FileFolder.'/thumbnail/'.$prefixe_mini.$FileName.'" -dpi 72 '.$convOptions.' -resize '.$resize_param.' -crop '.$offset_x.' '.$offset_y.' '.$DIMthumbnail.' '.$DIMthumbnailV.' -rmeta -rexifthumb "'.$FilesSource[$i].'"'); 30 31 $BlockThumbnail = true; 40 41 // Cadre autour de la miniature 42 if ($FRAMEparams != '0') { 43 // Si la miniature n'a pas encore été générée il faut le faire 44 if ($FileSource == $FilesSource[$i]) { 45 exec('files\nconvert.exe -q '.$Qthumbnail.' -out jpeg -o "'.$FileFolder.'/thumbnail/'.$prefixe_mini.$FileName.'" -dpi 72 '.$convOptions.' -resize '.$DIMthumbnail.' '.$DIMthumbnail.' -rmeta -rexifthumb "'.$FilesSource[$i].'"'); 46 $FileSource = $FileFolder.'/thumbnail/'.$prefixe_mini.$FileName; 47 } 48 49 $FRAMEparams = ExplodeString($FRAMEparams); 50 $colors['name'] = array_keys($FRAMEparams); 51 $colors['size'] = array_values($FRAMEparams); 52 53 $img = imagecreatefromjpeg($FileSource); 54 $x = imagesx($img)-1; 55 $y = imagesy($img)-1; 56 57 $colors[0] = hex2RGB(substr($colors['name'][0],1)); 58 $colors[1] = hex2RGB(substr($colors['name'][1],1)); 59 $colors[0] = imagecolorallocate($img, $colors[0]['r'], $colors[0]['g'], $colors[0]['b']); 60 $colors[1] = imagecolorallocate($img, $colors[1]['r'], $colors[1]['g'], $colors[1]['b']); 61 62 for ($m=0; $m<$colors['size'][0]; $m++) { 63 imagerectangle($img, $m, $m, $x-$m, $y-$m, $colors[0]); 64 } 65 for ($m=$colors['size'][0]; $m<$colors['size'][0]+$colors['size'][1]; $m++) { 66 imagerectangle($img, $m, $m, $x-$m, $y-$m, $colors[1]); 67 } 68 69 imagejpeg($img, $FileFolder.'/thumbnail/'.$prefixe_mini.$FileName, $Qthumbnail); 70 imagedestroy($img); 71 72 $BlockThumbnail = true; 73 $FileSource = $FileFolder.'/thumbnail/'.$prefixe_mini.$FileName; 74 } 32 75 } 76 33 77 ?> -
extensions/PHP_Optimisateur/plugins/create_custom_thumbs.xml
r8195 r8226 1 1 <create_custom_thumbs> 2 2 <mode>PluginsProcess</mode> 3 <active> true</active>3 <active>false</active> 4 4 <DIMthumbnailV>120</DIMthumbnailV> 5 <FRAMEparams>#c8c8c8:1;#0a0a0a:4</FRAMEparams> 5 6 </create_custom_thumbs> -
extensions/PHP_Optimisateur/plugins/create_folders_alpha.xml
r7991 r8226 1 1 <create_folders_alpha> 2 2 <mode>PluginsBefore</mode> 3 <active> true</active>3 <active>false</active> 4 4 </create_folders_alpha> -
extensions/PHP_Optimisateur/plugins/front2back_support.xml
r7991 r8226 1 1 <front2back_support> 2 2 <mode>PluginsProcess</mode> 3 <active> true</active>3 <active>false</active> 4 4 <NAMEverso>_verso</NAMEverso> 5 5 <MOVEverso>true</MOVEverso> -
extensions/PHP_Optimisateur/plugins/watermark.xml
r7991 r8226 1 1 <watermark> 2 2 <mode>PluginsBefore</mode> 3 <active> true</active>3 <active>false</active> 4 4 <waterFILE>logo.png</waterFILE> 5 5 <waterALPHA>80</waterALPHA> -
extensions/PHP_Optimisateur/setup.php
r8195 r8226 11 11 if (isset($_POST['DIRsource'])) { 12 12 // Quelques traitements 13 $_POST['copyCOLOR'] = implode(' ', $_POST['copyCOLOR']);14 13 $_POST['copyPOS'] = implode('-', $_POST['copyPOS']); 14 if (!preg_match('#^\#(.*)#', $_POST['copyCOLOR'])) $_POST['copyCOLOR'] = '#'.$_POST['copyCOLOR']; 15 15 16 16 // Plugins : ensembles existants même si vides & supprime les plugins manquants … … 56 56 echo '<div class="error">'.l10n($key).'</div>'; 57 57 } 58 echo '<div class="link"><a href="index.php"> '.l10n('Back').'</a> <a href="setup.php">'.l10n('Config').'</a></div>';58 echo '<div class="link"><a href="index.php">>» '.l10n('Back').'</a> <a href="setup.php">>» '.l10n('Config').'</a></div>'; 59 59 } 60 60 … … 80 80 ${$plugin_mode}[$plugin_name] = $plugin; 81 81 $NewPlugins[$plugin_name] = true; 82 } else if (!file_exists('plugins/'.$plugin_name.'.php')) {83 $MissingPlugins[$plugin_name] = true;84 82 } 85 83 } … … 97 95 98 96 ### Formulaire ### 99 $copyCOLOR = explode(' ', $copyCOLOR);100 97 $copyPOS = explode('-', $copyPOS); 101 98 … … 247 244 <tr> 248 245 <td><b>'.l10n('copyCOLOR').' :</b></td> 249 <td> 250 <input type="text" name="copyCOLOR[0]" value="'.$copyCOLOR[0].'" size="3" onFocus="this.select();" onKeyUp="suivant(this,\'copyCOLOR[1]\', 3)"/> 251 <input type="text" name="copyCOLOR[1]" value="'.$copyCOLOR[1].'" size="3" onFocus="this.select();" onKeyUp="suivant(this,\'copyCOLOR[2]\', 3)"/> 252 <input type="text" name="copyCOLOR[2]" value="'.$copyCOLOR[2].'" size="3" onFocus="this.select();" /> 253 </td> 246 <td><input type="text" name="copyCOLOR" value="'.$copyCOLOR.'" size="6"/></td> 254 247 </tr> 255 248 <tr> … … 265 258 <h2>'.l10n('Plugins').'</h2> 266 259 <ul>'; 260 267 261 // Affichage des plugins, un bloc par mode 268 262 foreach (array('PluginsBefore','PluginsProcess','PluginsAfter') as $mode) { … … 277 271 // Cas spéciaux dans le titre(nouveau, manquant) 278 272 if (isset($NewPlugins[$name])) { 279 echo ' <b class="new">'.l10n('New !').'</b>';273 echo ' <b class="new">'.l10n('New !').'</b>'; 280 274 } else if (isset($MissingPlugins[$name])) { 281 echo ' <b class="miss">'.l10n('Missing !').'</b>';275 echo ' <b class="miss">'.l10n('Missing !').'</b>'; 282 276 } 283 277 … … 287 281 echo '<tr> 288 282 <td>'.l10n('erase').' :</td> 289 <td><input type="checkbox" name="'.$mode.'['.$name.'][delete]" value="true" checked ="checked"/></td>283 <td><input type="checkbox" name="'.$mode.'['.$name.'][delete]" value="true" checked/></td> 290 284 </tr>'; 291 285 // sinon on affiche sa configuration 292 286 } else { 293 287 foreach ($config as $key => $value) { 288 $value = bool_to_string($value,1); 294 289 echo '<tr> 295 290 <td>'.$key.' :</td> 296 <td><input type="text" name="'.$mode.'['.$name.']['.$key.']" value="'. bool_to_string($value,1).'" size="'.strlen(bool_to_string($value,1)).'"/></td>291 <td><input type="text" name="'.$mode.'['.$name.']['.$key.']" value="'.$value.'" size="'.strlen($value).'"/></td> 297 292 </tr>'; 298 293 }
Note: See TracChangeset
for help on using the changeset viewer.