source: extensions/PHP_Optimisateur/plugins/front2back_support.php @ 7988

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

version 1.0

File size: 2.0 KB
Line 
1<?php
2/***************************************\
3|                       PHP OPTIMISATEUR                        |
4|               Plugin Front2Back Support               |
5\***************************************/
6
7## Déplace les versions alternatives dans 'thumbnail/verso'
8## Crée la version alternative hd dans 'pwg_high/verso'
9## Supprime le suffixe et déplace aussi les fichiers du repertoire source
10
11# PluginsProcess => 'front2back_support' => array('active' => true, 'NAMEverso' => '_verso')
12
13$NAMEverso = $PluginsProcess['front2back_support']['NAMEverso']; // Suffixe des versions alternatives
14$MOVEverso = $PluginsProcess['front2back_support']['MOVEverso']; // Déplacer les images originales dans un sous dosssier 'verso'
15
16if (strpos($matches[2], $NAMEverso) !== false) {
17        $matches[3] = str_replace($NAMEverso, '', $matches[2]);
18        # matches[3] = fichier sans verso
19       
20        // Image normale
21        if (!file_exists($matches[1].'/thumbnail/verso')) {
22                mkdir($matches[1].'/thumbnail/verso');
23        }
24        exec('nconvert.exe -q '.$Qnormal.' -out jpeg -o "'.$matches[1].'/thumbnail/verso/'.$matches[3].'" -dpi 72 -ratio -rtype lanczos -resize '.$DIMnormal.' '.$DIMnormal.' '.$copyNormal.' "'.$FilesSource[$i].'"');
25       
26        // Image hd
27        if ($DIRhighORNOT) {
28                if (!file_exists($matches[1].'/pwg_high/verso')) {
29                        mkdir($matches[1].'/pwg_high/verso');
30                }
31                if ($DIMhdORNOT) {
32                        exec('nconvert.exe -q '.$Qhd.' -out jpeg -o "'.$matches[1].'/pwg_high/verso/'.$matches[3].'" -dpi '.$DPI.' -ratio -rtype lanczos -rflag decr -resize '.$DIMhd.' '.$DIMhd.' '.$copyHD.' "'.$FilesSource[$i].'"');
33                } else {
34                        copy($FilesSource[$i], $matches[1].'/pwg_high/verso/'.$matches[3]);
35                }
36        }
37       
38        // Déplacement de l'image originale
39        if ($MOVEverso) {
40                $matches[4] = str_replace(substr($DIRsortie,0,-1), substr($DIRsource,0,-1), $matches[1]);
41                # matches[4] = dossier source
42                if (!file_exists($matches[4].'/verso')) {
43                        mkdir($matches[4].'/verso', 0777, true);
44                }
45                rename($matches[4].'/'.$matches[2], $matches[4].'/verso/'.$matches[3]);
46        }
47       
48        $BlockNormal = true;
49        $BlockThumbnail = true;
50        $BlockHigh = true;
51}
52?>
Note: See TracBrowser for help on using the repository browser.