source: extensions/PHP_Optimisateur/plugins/convert_pan/main.php @ 10337

Last change on this file since 10337 was 10337, checked in by mistic100, 13 years ago

new version 1.4, new plugin for Charlies Content, NConvert updated

File size: 1.9 KB
Line 
1<?php
2/***************************************\
3|                       PHP OPTIMISATEUR                        |
4|                 Plugin ConvertPan 1.3                 |
5\***************************************/
6
7## Crée des images normales plus hautes pour les panoramas (utilisation des paMOOrama par exemple)
8## Crée des miniatures rognées pour ne pas avoir de minuscules images
9
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
16if (!isset($BlockAll)) {
17
18if (
19        ($CP_detectmode == 'name' AND strpos($file['name'],$CP_namepanorama) !== false) OR 
20        ($CP_detectmode == 'ratio' AND $FileInfos['Width']/$FileInfos['Height'] >= $CP_ratiopan)
21) {
22
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}
39
40}
41?>
Note: See TracBrowser for help on using the repository browser.