- Timestamp:
- Jan 1, 2012, 10:09:17 PM (12 years ago)
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.