Changeset 12819 for extensions/PHP_Optimisateur/plugins
- Timestamp:
- Jan 1, 2012, 10:09:17 PM (12 years ago)
- Location:
- extensions/PHP_Optimisateur/plugins
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/PHP_Optimisateur/plugins/charlies_content/main.php
r10338 r12819 1 1 <?php 2 2 /***************************************\ 3 | PHP OPTIMISATEUR|4 | Plugin Charlie's Content 1.0|3 | PHP OPTIMISATEUR | 4 | Plugin Charlie's Content 1.0 | 5 5 \***************************************/ 6 6 … … 8 8 9 9 $CC_charlies_exts = array( // all extensions supported by Charlies' Content 10 11 12 13 10 'flv','swf','pls','m3u','wav','mid','au','aif','mp3','pdf', 11 'asf','wmv','divx','xvid','aiff','aac','bmp','gsm','mov','mpg', 12 'mpeg','mp4','m4a','psd','qt','qtif','qif','qti','snd','tif', 13 'tiff','3g2','3pg','zip','rar','gpx','3gp', 14 14 ); 15 15 $CC_video_exts = array( // extensions tested with FFmpeg 16 17 16 'wmv','mov','mkv','mp4','mpg','flv','asf','xvid','divx','mpeg', 17 'avi','rm', # <-- additional formats 18 18 ); 19 19 $CC_video_time = $CONF['Plugins']['charlies_content']['video_time']; … … 21 21 if (!function_exists('ffmpeg')) { 22 22 function ffmpeg($param, $log=true) { 23 23 global $LOG; 24 24 25 26 27 28 29 30 31 25 exec('include\ffmpeg.exe '. $param .' 2>&1', $out); 26 27 if ($log) { 28 $LOG[] = 'FFmpeg conversion : ' . $param; 29 } else { 30 return $out; 31 } 32 32 } 33 33 } 34 34 35 35 if (in_arrayi($file['ext'], $CC_video_exts)) { 36 37 38 39 40 41 42 43 44 45 46 47 48 49 36 // copie la video 37 copy_log($FilesSource[$i], $FilesSortie[$i]); 38 39 // infos sur le fichier 40 $infos = ffmpeg('-i "'. $FilesSource[$i] .'"', false); 41 $infos = implode('|', $infos); 42 43 // taille de la video 44 if (preg_match('#\, (\d+)x(\d+)#s', $infos, $sizes)) { 45 $FileInfos = array( 46 'Width' => $sizes[1], 47 'Height' => $sizes[2], 48 ); 49 } 50 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 ffmpeg('-i "'. $FilesSource[$i] .'" -an -ss '.$second.' -t 1 -r 1 -y -vcodec mjpeg -f mjpeg "temp/'.$file['name'].'.jpg"'); 65 66 67 68 69 70 71 72 73 74 75 76 77 78 51 // position de la miniature 52 $second = 10; 53 if ($CC_video_time == 'rand') { 54 if (preg_match('#Duration: ((\d+):(\d+):(\d+))#s', $infos, $time)) { 55 $total = ($time[2] * 3600) + ($time[3] * 60) + $time[4]; 56 $second = rand(1, ($total - 1)); 57 } 58 } else if (is_int($CC_video_time)) { 59 $second = $CC_video_time; 60 } 61 62 // création d'un ficher pleine taille temporaire 63 mkdir('temp', 0777, true); 64 ffmpeg('-i "'. $FilesSource[$i] .'" -an -ss '.$second.' -t 1 -r 1 -y -vcodec mjpeg -f mjpeg "temp/'.$file['name'].'.jpg"'); 65 66 // miniature, utilise Create Custom Thumbs si activé 67 if ( 68 isset($CONF['Plugins']['create_custom_thumbs']) 69 AND $CONF['Plugins']['create_custom_thumbs']['active'] 70 ) { 71 unset($BlockAll); 72 $CCT_filesource = 'temp/'.$file['name'].'.jpg'; 73 include('plugins/create_custom_thumbs/main.php'); 74 $BlockAll['main'] = true; 75 76 } else { 77 nconvert('-q '.$CONF['Qthumbnail'].' -out jpeg -o "'.$file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg" -dpi 72 '.$CONF['convOptions'].' -resize '.$CONF['DIMthumbnail'].' '.$CONF['DIMthumbnail'].' -rmeta -rexifthumb "temp/'.$file['name'].'.jpg"'); 78 } 79 79 80 81 82 83 84 85 86 80 // suppression des fichiers temporaires 81 @rrmdir('temp'); 82 83 $BlockThumbnail['charlies_content'] = true; 84 $BlockNormal['charlies_content'] = true; 85 $BlockHigh['charlies_content'] = true; 86 87 87 } else if (in_arrayi($file['ext'], $CC_charlies_exts)) { 88 89 90 91 92 93 88 // copie le fichier 89 copy_log($FilesSource[$i], $FilesSortie[$i]); 90 91 $BlockThumbnail['charlies_content'] = true; 92 $BlockNormal['charlies_content'] = true; 93 $BlockHigh['charlies_content'] = true; 94 94 } 95 95 -
extensions/PHP_Optimisateur/plugins/charlies_content/setup.php
r10337 r12819 3 3 4 4 switch ($PLUGIN_ACTION) { 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 5 // Affichage simple de la configuration 6 case 'read_config': 7 // vérifie que ffmpeg est bien présent 8 if (!file_exists('include/ffmpeg.exe') AND $plugin_config['active']) { 9 $ERRORS['fatal'][] = 'charlies_content.error_ffmpeg'; 10 } 11 12 $PAGE['content'] .= ' 13 <table> 14 <tr> 15 <td>'.l10n('charlies_content.video_time').' :</td> 16 <td>'.bool_to_string($plugin_config['video_time']).($plugin_config['video_time']!=='rand' ? ' sec':'om').'</td> 17 </tr> 18 </table>'; 19 break; 20 21 22 // Actions avant enregistrement 23 case 'save_config': 24 if (!is_decimal($_POST['Plugins']['charlies_content']['video_time']) AND $_POST['Plugins']['charlies_content']['video_time'] != 'rand') { 25 $_POST['Plugins']['charlies_content']['video_time'] = 'rand'; 26 $ERRORS['conf'][] = array(l10n('charlies_content.video_time'), 'must_be_integer'); 27 } 28 28 29 29 break; 30 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 31 32 // Formulaire d'édition 33 case 'edit_config': 34 $PAGE['content'] .=' 35 <table> 36 <tr> 37 <td>'.l10n('charlies_content.video_time').' :</td> 38 <td> 39 <input type="text" name="Plugins[charlies_content][video_time]" value="'.$plugin_config['video_time'].'" size="3"/>sec 40 <i>'.l10n('charlies_content.rand').'</i> 41 </td> 42 </tr> 43 </table>'; 44 break; 45 45 } 46 46 ?> -
extensions/PHP_Optimisateur/plugins/convert_pan/main.php
r10337 r12819 1 1 <?php 2 2 /***************************************\ 3 | PHP OPTIMISATEUR|4 | Plugin ConvertPan 1.3|3 | PHP OPTIMISATEUR | 4 | Plugin ConvertPan 1.3 | 5 5 \***************************************/ 6 6 … … 8 8 ## Crée des miniatures rognées pour ne pas avoir de minuscules images 9 9 10 $CP_namepanorama = $CONF['Plugins']['convert_pan']['NAMEpanorama']; 11 $CP_detectmode = $CONF['Plugins']['convert_pan']['DetectMode']; 12 $CP_dimpanorama = $CONF['Plugins']['convert_pan']['DIMpanorama']; 13 $CP_ratiopan = $CONF['Plugins']['convert_pan']['RatioPan']; 14 $CP_ratiopanthumb = $CONF['Plugins']['convert_pan']['RatioPanThumb']; 10 $CP_namepanorama = $CONF['Plugins']['convert_pan']['NAMEpanorama']; // Suffixe des panoramas 11 $CP_detectmode = $CONF['Plugins']['convert_pan']['DetectMode']; // Mode de détection 12 $CP_dimpanorama = $CONF['Plugins']['convert_pan']['DIMpanorama']; // Hauteur des panoramas normaux 13 $CP_ratiopan = $CONF['Plugins']['convert_pan']['RatioPan']; // Ratio des panoramas 14 $CP_ratiopanthumb = $CONF['Plugins']['convert_pan']['RatioPanThumb']; // Ratio des miniatures 15 15 16 16 if (!isset($BlockAll)) { 17 17 18 18 if ( 19 20 19 ($CP_detectmode == 'name' AND strpos($file['name'],$CP_namepanorama) !== false) OR 20 ($CP_detectmode == 'ratio' AND $FileInfos['Width']/$FileInfos['Height'] >= $CP_ratiopan) 21 21 ) { 22 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 23 if (!isset($BlockNormal) AND $CP_dimpanorama != 0) { 24 nconvert('-q '.$CONF['Qnormal'].' -out jpeg -o "'.$file['folder_out'].$file['name'].'.jpg" -dpi 72 '.$CONF['convOptions'].' -resize 0 '.$CP_dimpanorama.' '.$CONF['copyNormal'].' "'.$FilesSource[$i].'"'); 25 $BlockNormal['convert_pan'] = true; 26 } 27 28 if (!isset($BlockThumbnail) AND $CP_ratiopanthumb != 0) { 29 $DIMthumbnailV = $CONF['DIMthumbnail']/$CP_ratiopanthumb; 30 31 // on prend la miniature au milieu du panorama 32 $tmp_x = $FileInfos['Width'] * $DIMthumbnailV / $FileInfos['Height']; 33 $offset_x = ($tmp_x - $CONF['DIMthumbnail']) / 2; 34 35 nconvert('-q '.$CONF['Qthumbnail'].' -out jpeg -o "'.$file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg" -dpi 72 '.$CONF['convOptions'].' -resize 0 '.$DIMthumbnailV.' -crop '.$offset_x.' 0 '.$CONF['DIMthumbnail'].' '.$DIMthumbnailV.' -rmeta -rexifthumb "'.$FilesSource[$i].'"'); 36 $BlockThumbnail['convert_pan'] = true; 37 } 38 38 } 39 39 -
extensions/PHP_Optimisateur/plugins/convert_pan/setup.php
r10337 r12819 3 3 4 4 switch ($PLUGIN_ACTION) { 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 5 // Affichage simple de la configuration 6 case 'read_config': 7 $PAGE['content'] .= ' 8 <table> 9 <tr> 10 <td>'.l10n('convert_pan.DetectMode').' :</td> 11 <td>'.$plugin_config['DetectMode'].'</td> 12 </tr>'; 13 14 if ($plugin_config['DetectMode'] == 'name') { 15 $PAGE['content'] .= ' 16 <tr> 17 <td>'.l10n('convert_pan.NAMEpanorama').' :</td> 18 <td>'.$plugin_config['NAMEpanorama'].'</td> 19 </tr>'; 20 } else if ($plugin_config['DetectMode'] == 'ratio') { 21 $PAGE['content'] .= ' 22 <tr> 23 <td>'.l10n('convert_pan.RatioPan').' :</td> 24 <td>'.$plugin_config['RatioPan'].'</td> 25 </tr>'; 26 } 27 28 $PAGE['content'] .= ' 29 <tr> 30 <td>'.l10n('convert_pan.DIMpanorama').' :</td> 31 <td>'.$plugin_config['DIMpanorama'].' px</td> 32 </tr> 33 <tr> 34 <td>'.l10n('convert_pan.RatioPanThumb').' :</td> 35 <td>'.$plugin_config['RatioPanThumb'].'</td> 36 </tr> 37 </table>'; 38 break; 39 40 // Actions avant enregistrement 41 case 'save_config': 42 $_POST['Plugins']['convert_pan']['NAMEpanorama'] = delete_special_car($_POST['Plugins']['convert_pan']['NAMEpanorama']); 43 44 if (!is_decimal($_POST['Plugins']['convert_pan']['DIMpanorama'])) { 45 $_POST['Plugins']['convert_pan']['DIMpanorama'] = 500; 46 $ERRORS['conf'][] = array(l10n('convert_pan.DIMpanorama'), 'must_be_integer'); 47 } 48 if (!is_decimal($_POST['Plugins']['convert_pan']['RatioPanThumb'])) { 49 $_POST['Plugins']['convert_pan']['RatioPanThumb'] = 1.7; 50 $ERRORS['conf'][] = array(l10n('convert_pan.RatioPanThumb'), 'must_be_decimal'); 51 } 52 if (!is_decimal($_POST['Plugins']['convert_pan']['RatioPan'])) { 53 $_POST['Plugins']['convert_pan']['RatioPan'] = 2.85; 54 $ERRORS['conf'][] = array(l10n('convert_pan.RatioPan'), 'must_be_decimal'); 55 } 56 57 break; 58 59 // Formulaire d'édition 60 case 'edit_config': 61 $PAGE['content'] .= ' 62 <script type="text/javascript"> 63 function ToggleConfig(sel, section){ 64 var obj = $("#convert_pan-tr-"+section); 65 if(sel.checked){ 66 obj.show(); 67 }else{ 68 obj.hide(); 69 } 70 } 71 </script> 72 73 <table> 74 <tr> 75 <td>'.l10n('convert_pan.DetectMode').' :</td> 76 <td> 77 <input type="radio" id="convert_pan-radio-name" name="Plugins[convert_pan][DetectMode]" value="name" onchange="ToggleConfig(this,\'name\');" '.(($plugin_config['DetectMode']=='name')?'checked="checked"':'').'/> 78 <label for="convert_pan-radio-name">'.l10n('convert_pan.DetectMode.name').'</label> 79 <input type="radio" id="convert_pan.radio.ratio" name="Plugins[convert_pan][DetectMode]" value="ratio" onchange="ToggleConfig(this,\'ratio\');" '.(($plugin_config['DetectMode']=='ratio')?'checked="checked"':'').'/> 80 <label for="convert_pan-radio-ratio">'.l10n('convert_pan.DetectMode.ratio').'</label> 81 </td> 82 </tr> 83 <tr id="convert_pan-tr-name"> 84 <td>'.l10n('convert_pan.NAMEpanorama').' :</td> 85 <td><input type="text" name="Plugins[convert_pan][NAMEpanorama]" value="'.$plugin_config['NAMEpanorama'].'" size="6"/></td> 86 </tr> 87 <tr id="convert_pan-tr-ratio"> 88 <td>'.l10n('convert_pan.RatioPan').' :</td> 89 <td><input type="text" name="Plugins[convert_pan][RatioPan]" value="'.$plugin_config['RatioPan'].'" size="3"/>px</td> 90 </tr> 91 92 <tr> 93 <td>'.l10n('convert_pan.DIMpanorama').' :</td> 94 <td> 95 <input type="text" name="Plugins[convert_pan][DIMpanorama]" value="'.$plugin_config['DIMpanorama'].'" size="3"/>px 96 <i>'.l10n('convert_pan.unactive').'</i> 97 </td> 98 </tr> 99 <tr> 100 <td>'.l10n('convert_pan.RatioPanThumb').' :</td> 101 <td> 102 <input type="text" name="Plugins[convert_pan][RatioPanThumb]" value="'.$plugin_config['RatioPanThumb'].'" size="3"/> 103 <i>'.l10n('convert_pan.unactive').'</i> 104 </td> 105 </tr> 106 </table> 107 108 <script type="text/javascript"> 109 ToggleConfig(document.forms[0].elements["Plugins[convert_pan][DetectMode]"][0], "name"); 110 ToggleConfig(document.forms[0].elements["Plugins[convert_pan][DetectMode]"][1], "ratio"); 111 </script>'; 112 break; 113 113 } 114 114 ?> -
extensions/PHP_Optimisateur/plugins/create_custom_thumbs/main.php
r10337 r12819 1 1 <?php 2 2 /***************************************\ 3 | PHP OPTIMISATEUR|4 | Plugin CreateCustomThumbs 1.1|3 | PHP OPTIMISATEUR | 4 | Plugin CreateCustomThumbs 1.1 | 5 5 \***************************************/ 6 6 … … 8 8 ## Dépend de la valeur de $CONF['DIMthumbnail'] 9 9 10 if(!isset($CCT_filesource)) $CCT_filesource = $FilesSource[$i]; // fichier de travail 11 $CCT_dimthumbnail = $CONF['Plugins']['create_custom_thumbs']['DIMthumbnailV']; // Hauteur de l'image 12 $CCT_frameparams = $CONF['Plugins']['create_custom_thumbs']['FRAMEparams']; // Paramètres du cadre 13 10 14 if (!isset($BlockAll)) { 11 15 12 16 // CreateCustomThumbs à la priorité sur ConvertPan 13 17 if (isset($BlockThumbnail['convert_pan']) OR !isset($BlockThumbnail)) { 18 19 // Miniature de taille personnalisée 20 if ($CCT_dimthumbnail != 0) { 21 $max = max($CONF['DIMthumbnail'], $CCT_dimthumbnail); 14 22 15 if(!isset($CCT_filesource)) $CCT_filesource = $FilesSource[$i]; // fichier de travail 16 $CCT_dimthumbnail = $CONF['Plugins']['create_custom_thumbs']['DIMthumbnailV']; // Hauteur de l'image 17 $CCT_frameparams = $CONF['Plugins']['create_custom_thumbs']['FRAMEparams']; // Paramètres du cadre 18 19 // Miniature de taille personnalisée 20 if ($CCT_dimthumbnail != 0) { 21 $max = max($CONF['DIMthumbnail'], $CCT_dimthumbnail); 23 // on prend la miniature au milieu de l'image 24 if ($FileInfos['Height'] >= $FileInfos['Width']) { 25 $resize_param = $max.' 0'; 26 $tmp_x = $max; 27 $tmp_y = $max * $FileInfos['Height'] / $FileInfos['Width']; 28 } else { 29 $resize_param = '0 '.$max; 30 $tmp_x = $max * $FileInfos['Width'] / $FileInfos['Height']; 31 $tmp_y = $max; 32 } 33 34 $offset_x = ceil(($tmp_x - $CONF['DIMthumbnail']) / 2); 35 $offset_y = ceil(($tmp_y - $CCT_dimthumbnail) / 2); 36 37 nconvert('-overwrite -q '.$CONF['Qthumbnail'].' -out jpeg -o "'.$file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg" -dpi 72 '.$CONF['convOptions'].' -resize '.$resize_param.' -crop '.$offset_x.' '.$offset_y.' '.$CONF['DIMthumbnail'].' '.$CCT_dimthumbnail.' -rmeta -rexifthumb "'.$CCT_filesource.'"'); 38 39 $BlockThumbnail['create_custom_thumbs'] = true; 40 $CCT_filesource = $file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg'; 41 } 22 42 23 // on prend la miniature au milieu de l'image 24 if ($FileInfos['Height'] >= $FileInfos['Width']) { 25 $resize_param = $max.' 0'; 26 $tmp_x = $max; 27 $tmp_y = $max * $FileInfos['Height'] / $FileInfos['Width']; 28 } else { 29 $resize_param = '0 '.$max; 30 $tmp_x = $max * $FileInfos['Width'] / $FileInfos['Height']; 31 $tmp_y = $max; 32 } 33 34 $offset_x = ceil(($tmp_x - $CONF['DIMthumbnail']) / 2); 35 $offset_y = ceil(($tmp_y - $CCT_dimthumbnail) / 2); 36 37 nconvert('-overwrite -q '.$CONF['Qthumbnail'].' -out jpeg -o "'.$file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg" -dpi 72 '.$CONF['convOptions'].' -resize '.$resize_param.' -crop '.$offset_x.' '.$offset_y.' '.$CONF['DIMthumbnail'].' '.$CCT_dimthumbnail.' -rmeta -rexifthumb "'.$CCT_filesource.'"'); 38 39 $BlockThumbnail['create_custom_thumbs'] = true; 40 $CCT_filesource = $file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg'; 41 } 43 // Cadre autour de la miniature 44 if ($CCT_frameparams['size1'] != 0 OR $CCT_frameparams['size2'] != 0) { 45 // Si la miniature n'a pas encore été générée il faut le faire 46 if ($CCT_filesource == $FilesSource[$i]) { 47 nconvert('-q '.$CONF['Qthumbnail'].' -out jpeg -o "'.$file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg" -dpi 72 '.$CONF['convOptions'].' -resize '.$CONF['DIMthumbnail'].' '.$CONF['DIMthumbnail'].' -rmeta -rexifthumb "'.$FilesSource[$i].'"'); 48 $CCT_filesource = $file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg'; 49 } 42 50 43 // Cadre autour de la miniature 44 if ($CCT_frameparams['size1'] != 0 OR $CCT_frameparams['size2'] != 0) { 45 // Si la miniature n'a pas encore été générée il faut le faire 46 if ($CCT_filesource == $FilesSource[$i]) { 47 nconvert('-q '.$CONF['Qthumbnail'].' -out jpeg -o "'.$file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg" -dpi 72 '.$CONF['convOptions'].' -resize '.$CONF['DIMthumbnail'].' '.$CONF['DIMthumbnail'].' -rmeta -rexifthumb "'.$FilesSource[$i].'"'); 48 $CCT_filesource = $file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg'; 49 } 51 $img = imagecreatefromjpeg($CCT_filesource); 52 $x = imagesx($img)-1; 53 $y = imagesy($img)-1; 54 55 $colors[0] = hex2RGB($CCT_frameparams['color1']); 56 $colors[1] = hex2RGB($CCT_frameparams['color2']); 57 $colors[0] = imagecolorallocate($img, $colors[0]['r'], $colors[0]['g'], $colors[0]['b']); 58 $colors[1] = imagecolorallocate($img, $colors[1]['r'], $colors[1]['g'], $colors[1]['b']); 50 59 51 $img = imagecreatefromjpeg($CCT_filesource); 52 $x = imagesx($img)-1; 53 $y = imagesy($img)-1; 54 55 $colors[0] = hex2RGB($CCT_frameparams['color1']); 56 $colors[1] = hex2RGB($CCT_frameparams['color2']); 57 $colors[0] = imagecolorallocate($img, $colors[0]['r'], $colors[0]['g'], $colors[0]['b']); 58 $colors[1] = imagecolorallocate($img, $colors[1]['r'], $colors[1]['g'], $colors[1]['b']); 59 60 for ($m=0; $m<$CCT_frameparams['size1']; $m++) { 61 imagerectangle($img, $m, $m, $x-$m, $y-$m, $colors[0]); 62 } 63 for ($m=$CCT_frameparams['size1']; $m<$CCT_frameparams['size1']+$CCT_frameparams['size2']; $m++) { 64 imagerectangle($img, $m, $m, $x-$m, $y-$m, $colors[1]); 65 } 66 67 imagejpeg($img, $file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg', $CONF['Qthumbnail']); 68 imagedestroy($img); 69 70 $BlockThumbnail['create_custom_thumbs'] = true; 71 $CCT_filesource = $file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg'; 72 } 60 for ($m=0; $m<$CCT_frameparams['size1']; $m++) { 61 imagerectangle($img, $m, $m, $x-$m, $y-$m, $colors[0]); 62 } 63 for ($m=$CCT_frameparams['size1']; $m<$CCT_frameparams['size1']+$CCT_frameparams['size2']; $m++) { 64 imagerectangle($img, $m, $m, $x-$m, $y-$m, $colors[1]); 65 } 66 67 imagejpeg($img, $file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg', $CONF['Qthumbnail']); 68 imagedestroy($img); 69 70 $BlockThumbnail['create_custom_thumbs'] = true; 71 $CCT_filesource = $file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg'; 72 } 73 73 } 74 74 -
extensions/PHP_Optimisateur/plugins/create_custom_thumbs/setup.php
r10337 r12819 3 3 4 4 switch ($PLUGIN_ACTION) { 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 5 // Affichage simple de la configuration 6 case 'read_config': 7 $plugin_config['FRAMEparams']['color1'] = nice_hex_color($plugin_config['FRAMEparams']['color1']); 8 $plugin_config['FRAMEparams']['color2'] = nice_hex_color($plugin_config['FRAMEparams']['color2']); 9 10 $PAGE['content'] .= ' 11 <table> 12 <tr> 13 <td>'.l10n('create_custom_thumbs.DIMthumbnailV').' :</td> 14 <td>'.bool_to_string($plugin_config['DIMthumbnailV']).' px</td> 15 </tr> 16 <tr> 17 <td>'.l10n('create_custom_thumbs.FRAMEparams').' 1 :</td> 18 <td> 19 #'.$plugin_config['FRAMEparams']['color1'].' 20 <span class="color-display" style="background-color:#'.nice_hex_color($plugin_config['FRAMEparams']['color1']).';"> </span> 21 '.$plugin_config['FRAMEparams']['size1'].'px 22 </td> 23 </tr> 24 <tr> 25 <td>'.l10n('create_custom_thumbs.FRAMEparams').' 2 :</td> 26 <td> 27 #'.$plugin_config['FRAMEparams']['color2'].' 28 <span class="color-display" style="background-color:#'.nice_hex_color($plugin_config['FRAMEparams']['color2']).';"> </span> 29 '.$plugin_config['FRAMEparams']['size2'].'px 30 </td> 31 </tr> 32 </table>'; 33 break; 34 35 36 // Actions avant enregistrement 37 case 'save_config': 38 $_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['color1'] = str_replace('#',null, $_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['color1']); 39 $_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['color2'] = str_replace('#',null, $_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['color2']); 40 41 if (!is_decimal($_POST['Plugins']['create_custom_thumbs']['DIMthumbnailV'])) { 42 $_POST['Plugins']['create_custom_thumbs']['DIMthumbnailV'] = 0; 43 $ERRORS['conf'][] = array(l10n('create_custom_thumbs.DIMthumbnailV'), 'must_be_integer'); 44 } 45 if (!is_decimal($_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['size1'])) { 46 $_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['size1'] = 0; 47 $ERRORS['conf'][] = array(l10n('create_custom_thumbs.FRAMEparams').' 1', 'must_be_integer'); 48 } 49 if (!is_decimal($_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['size2'])) { 50 $_POST['Plugins']['create_custom_thumbs']['FRAMEparams']['size2'] = 0; 51 $ERRORS['conf'][] = array(l10n('create_custom_thumbs.FRAMEparams').' 2', 'must_be_integer'); 52 } 53 54 break; 55 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 56 57 // Formulaire d'édition 58 case 'edit_config': 59 $plugin_config['FRAMEparams']['color1'] = nice_hex_color($plugin_config['FRAMEparams']['color1']); 60 $plugin_config['FRAMEparams']['color2'] = nice_hex_color($plugin_config['FRAMEparams']['color2']); 61 62 $PAGE['content'] .=' 63 <table> 64 <tr> 65 <td>'.l10n('create_custom_thumbs.DIMthumbnailV').' :</td> 66 <td> 67 <input type="text" name="Plugins[create_custom_thumbs][DIMthumbnailV]" value="'.$plugin_config['DIMthumbnailV'].'" size="3"/>px 68 <i>'.l10n('create_custom_thumbs.unactive').'</i> 69 </td> 70 </tr> 71 <tr> 72 <td>'.l10n('create_custom_thumbs.FRAMEparams').' 1 :</td> 73 <td> 74 <input type="text" id="CCT-color1" name="Plugins[create_custom_thumbs][FRAMEparams][color1]" value="'.$plugin_config['FRAMEparams']['color1'].'" size="6"/> 75 <input type="text" name="Plugins[create_custom_thumbs][FRAMEparams][size1]" value="'.$plugin_config['FRAMEparams']['size1'].'" size="1"/>px 76 <i>'.l10n('create_custom_thumbs.unactive').'</i> 77 </td> 78 </tr> 79 <tr> 80 <td>'.l10n('create_custom_thumbs.FRAMEparams').' 2 :</td> 81 <td> 82 <input type="text" id="CCT-color2" name="Plugins[create_custom_thumbs][FRAMEparams][color2]" value="'.$plugin_config['FRAMEparams']['color2'].'" size="6"/> 83 <input type="text" name="Plugins[create_custom_thumbs][FRAMEparams][size2]" value="'.$plugin_config['FRAMEparams']['size2'].'" size="1"/>px 84 <i>'.l10n('create_custom_thumbs.unactive').'</i> 85 </td> 86 </tr> 87 <script type="text/javascript"> 88 $("#CCT-color1").ColorPicker({ 89 onSubmit: function(hsb, hex, rgb, el) { $(el).val(hex); $(el).ColorPickerHide(); }, 90 onChange: function(hsb, hex, rgb, el) { $("#CCT-color1").val(hex); }, 91 onBeforeShow: function () { $(this).ColorPickerSetColor(this.value); } 92 }) .bind("keyup", function(){ $(this).ColorPickerSetColor(this.value); }); 93 $("#CCT-color2").ColorPicker({ 94 onSubmit: function(hsb, hex, rgb, el) { $(el).val(hex); (el).ColorPickerHide(); }, 95 onChange: function(hsb, hex, rgb, el) { $("#CCT-color2").val(hex); }, 96 onBeforeShow: function () { $(this).ColorPickerSetColor(this.value); } 97 }) .bind("keyup", function(){ $(this).ColorPickerSetColor(this.value); }); 98 </script> 99 </table>'; 100 break; 101 101 } 102 102 ?> -
extensions/PHP_Optimisateur/plugins/create_folders_alpha/main.php
r10337 r12819 1 1 <?php 2 2 /***************************************\ 3 | PHP OPTIMISATEUR|4 | Plugin CreateFoldersAlpha 1.2|3 | PHP OPTIMISATEUR | 4 | Plugin CreateFoldersAlpha 1.2 | 5 5 \***************************************/ 6 6 … … 11 11 12 12 while ($file = readdir($handle)) { 13 14 15 16 17 13 if ($file != '.' && $file != '..' && !is_dir($CONF['DIRsource'].'/'.$file)) { 14 // Récupère le parties du nom servant à créer les dossiers 15 if (preg_match('#^(.{1})([^_.]*)_(.*)#', $file, $matches)) { 16 $Letter = strtoupper($matches[1]); 17 $FolderName = $matches[1].$matches[2]; 18 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 19 // Crée les dossier 20 if (!file_exists($CONF['DIRsource'].$Letter.'/'.$FolderName)) { 21 mkdir_log($CONF['DIRsource'].$Letter.'/'.$FolderName); 22 } 23 24 // Déplace le fichier 25 rename_log($CONF['DIRsource'].$file, $CONF['DIRsource'].$Letter.'/'.$FolderName.'/'.$file, true); 26 27 } else { 28 $LOG[] = 'The file '.$CONF['DIRsource'].$file.' doesn\'t match the patern #^(.{1})([^_.]*)_(.*)#, not moved'; 29 } 30 31 $done = true; 32 } 33 33 } 34 34 -
extensions/PHP_Optimisateur/plugins/front2back_support/main.php
r10337 r12819 1 1 <?php 2 2 /***************************************\ 3 | PHP OPTIMISATEUR|4 | Plugin Front2Back Support 1.2|3 | PHP OPTIMISATEUR | 4 | Plugin Front2Back Support 1.2 | 5 5 \***************************************/ 6 6 … … 17 17 // applique le tag au fichier normal si il existe un verso 18 18 if (file_exists($file['folder_src'].$file['name'].$F2B_nameverso.'.'.$file['ext']) AND !empty($F2B_tagverso)) { 19 20 19 nconvert('-iptc_add 25 "'.$F2B_tagverso.'" "'.$FilesSource[$i].'"'); 20 $LOG[] = 'Tag "'.$F2B_tagverso.'" added to '.$FilesSource[$i]; 21 21 } 22 22 23 23 if (strpos($file['name'], $F2B_nameverso) !== false) { 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 24 $file['name_clean'] = str_replace($F2B_nameverso,null,$file['name']); 25 26 if (!empty($F2B_tagverso)) { 27 nconvert('-iptc_add 25 "'.$F2B_tagverso.'" "'.$FilesSource[$i].'"'); 28 $LOG[] = 'Tag "'.$F2B_tagverso.'" added to '.$FilesSource[$i]; 29 } 30 31 // Image normale 32 if (!file_exists($file['folder_out'].'thumbnail/verso')) { 33 mkdir_log($file['folder_out'].'thumbnail/verso'); 34 } 35 nconvert('-q '.$CONF['Qnormal'].' -out jpeg -o "'.$file['folder_out'].'thumbnail/verso/'.$file['name_clean'].'.jpg" -dpi 72 '.$CONF['convOptions'].' -resize '.$CONF['DIMnormal'].' '.$CONF['DIMnormal'].' '.$CONF['copyNormal'].' "'.$FilesSource[$i].'"'); 36 37 // Image hd 38 if ($CONF['DIRhighORNOT']) { 39 if (!file_exists($file['folder_out'].'pwg_high/verso')) { 40 mkdir($file['folder_out'].'pwg_high/verso'); 41 $LOG[] = 'Dir '.$file['folder_out'].'pwg_high/verso/ created'; 42 } 43 if ($CONF['DIMhdORNOT']) { 44 nconvert('-q '.$CONF['Qhd'].' -out jpeg -o "'.$file['folder_out'].'pwg_high/verso/'.$file['name_clean'].'.jpg" -dpi '.$CONF['DPI'].' '.$CONF['convOptions'].' -resize '.$CONF['DIMhd'].' '.$CONF['DIMhd'].' '.$CONF['copyHD'].' "'.$FilesSource[$i].'"'); 45 } else if (strtolower($file['ext']) != 'jpg') { 46 nconvert('-q '.$CONF['Qhd'].' -out jpeg -o "'.$file['folder_out'].'pwg_high/'.$file['name_clean'].'.jpg" "'.$FilesSource[$i].'"'); 47 } else { 48 copy_log($FilesSource[$i], $file['folder_out'].'pwg_high/verso/'.$file['name_clean'].'.jpg'); 49 } 50 } 51 52 // Déplacement de l'image originale 53 if ($F2B_moveverso) { 54 if (!file_exists($file['folder_src'].'verso')) { 55 mkdir_log($file['folder_src'].'verso', 0777, true); 56 } 57 rename_log($file['folder_src'].$file['name'].'.'.$file['ext'], $file['folder_src'].'verso/'.$file['name_clean'].'.'.$file['ext'], true); 58 } 59 60 // Suppression de la miniature si déjà crée (par un autre plugin) 61 if (file_exists($file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg')) { 62 unlink($file['folder_out'].'thumbnail/'.$CONF['prefixe_mini'].$file['name'].'.jpg'); 63 } 64 // Suppression de l'image HD si déjà crée (par un autre plugin) 65 if (file_exists($file['folder_out'].'pwg_high/'.$file['name'].'.jpg')) { 66 unlink($file['folder_out'].'pwg_high/'.$file['name'].'.jpg'); 67 } 68 69 $BlockNormal['front2back_support'] = true; 70 $BlockThumbnail['front2back_support'] = true; 71 $BlockHigh['front2back_support'] = true; 72 72 } 73 73 -
extensions/PHP_Optimisateur/plugins/front2back_support/setup.php
r10337 r12819 3 3 4 4 switch ($PLUGIN_ACTION) { 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 5 // Affichage simple de la configuration 6 case 'read_config': 7 $PAGE['content'] .= ' 8 <table> 9 <tr> 10 <td>'.l10n('front2back_support.NAMEverso').' :</td> 11 <td>'.$plugin_config['NAMEverso'].'</td> 12 </tr> 13 <tr> 14 <td>'.l10n('front2back_support.MOVEverso').' :</td> 15 <td>'.bool_to_string($plugin_config['MOVEverso']).'</td> 16 </tr> 17 <tr> 18 <td>'.l10n('front2back_support.TAGverso').' :</td> 19 <td>'.$plugin_config['TAGverso'].'</td> 20 </tr> 21 </table>'; 22 break; 23 24 // Actions avant enregistrement 25 case 'save_config': 26 $_POST['Plugins']['front2back_support']['NAMEverso'] = delete_special_car($_POST['Plugins']['front2back_support']['NAMEverso']); 27 break; 28 29 // Formulaire d'édition 30 case 'edit_config': 31 $PAGE['content'] .= ' 32 <table> 33 <tr> 34 <td>'.l10n('front2back_support.NAMEverso').' :</td> 35 <td><input type="text" name="Plugins[front2back_support][NAMEverso]" value="'.$plugin_config['NAMEverso'].'" size="6"/></td> 36 </tr> 37 <tr> 38 <td>'.l10n('front2back_support.MOVEverso').' :</td> 39 <td> 40 <input type="radio" id="front2back_support-move1" name="Plugins[front2back_support][MOVEverso]" value="true" '.(($plugin_config['MOVEverso'])?'checked="checked"':'').'/> 41 <label for="front2back_support-move1">'.l10n('yes').'</label> 42 <input type="radio" id="front2back_support-move2" name="Plugins[front2back_support][MOVEverso]" value="false" '.((!$plugin_config['MOVEverso'])?'checked="checked"':'').'/> 43 <label for="front2back_support-move2">'.l10n('no').'</label> 44 </td> 45 </tr> 46 <tr> 47 <td>'.l10n('front2back_support.TAGverso').' :</td> 48 <td> 49 <input type="text" name="Plugins[front2back_support][TAGverso]" value="'.$plugin_config['TAGverso'].'" size="10"/> 50 <i>'.l10n('front2back_support.unactive').'</i> 51 </td> 52 </tr> 53 </table>'; 54 break; 55 55 } 56 56 ?> -
extensions/PHP_Optimisateur/plugins/watermark/main.php
r9276 r12819 1 1 <?php 2 2 /***************************************\ 3 | PHP OPTIMISATEUR|4 | Plugin Watermark 1.1|3 | PHP OPTIMISATEUR | 4 | Plugin Watermark 1.1 | 5 5 \***************************************/ 6 6 … … 8 8 ## Dépend des valeurs de $CONF['copyONhd'], $CONF['copyONnormal'] et $CONF['copyPOS'] 9 9 10 $WM_waterfile = $CONF['Plugins']['watermark']['waterFILE']; // Fichier à incruster10 $WM_waterfile = $CONF['Plugins']['watermark']['waterFILE']; // Fichier à incruster 11 11 $WM_wateralpha = $CONF['Plugins']['watermark']['waterALPHA']; // Opacité 12 12 13 13 if (file_exists($WM_waterfile)) { 14 15 16 17 18 19 20 14 if ($CONF['copyONhd']) { 15 $CONF['copyHD'] = '-wmfile "'.$WM_waterfile.'" -wmflag '.$CONF['copyPOS'].' -wmpos 0 0 -wmopacity '.$WM_wateralpha.''; 16 } 17 18 if ($CONF['copyONnormal']) { 19 $CONF['copyNormal'] = '-wmfile "'.$WM_waterfile.'" -wmflag '.$CONF['copyPOS'].' -wmpos 0 0 -wmopacity '.$WM_wateralpha.''; 20 } 21 21 } 22 22 ?> -
extensions/PHP_Optimisateur/plugins/watermark/setup.php
r10337 r12819 3 3 4 4 switch ($PLUGIN_ACTION) { 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 5 // Affichage simple de la configuration 6 case 'read_config': 7 $PAGE['content'] .= ' 8 <table> 9 <tr> 10 <td>'.l10n('watermark.waterFILE').' :</td> 11 <td>'.$plugin_config['waterFILE'].'</td> 12 </tr> 13 <tr> 14 <td>'.l10n('watermark.waterALPHA').' :</td> 15 <td>'.$plugin_config['waterALPHA'].' %</td> 16 </tr> 17 </table>'; 18 break; 19 20 // Actions avant enregistrement 21 case 'save_config': 22 if (!is_decimal($_POST['Plugins']['watermark']['waterALPHA'])) { 23 $_POST['Plugins']['watermark']['waterALPHA'] = 80; 24 $ERRORS['conf'][] = array(l10n('watermark.waterALPHA'), 'must_be_integer'); 25 } 26 27 break; 28 29 // Formulaire d'édition 30 case 'edit_config': 31 $PAGE['content'] .= ' 32 <table> 33 <tr> 34 <td>'.l10n('watermark.waterFILE').' :</td> 35 <td><input type="text" name="Plugins[watermark][waterFILE]" value="'.$plugin_config['waterFILE'].'" size="10"/></td> 36 </tr> 37 <tr> 38 <td>'.l10n('watermark.waterALPHA').' :</td> 39 <td><input type="text" name="Plugins[watermark][waterALPHA]" value="'.$plugin_config['waterALPHA'].'" size="3"/>%</td> 40 </tr> 41 </table>'; 42 break; 43 43 } 44 44 ?>
Note: See TracChangeset
for help on using the changeset viewer.