[7988] | 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 | $NAMEverso = $PluginsProcess['front2back_support']['NAMEverso']; // Suffixe des versions alternatives |
---|
| 12 | $MOVEverso = $PluginsProcess['front2back_support']['MOVEverso']; // Déplacer les images originales dans un sous dosssier 'verso' |
---|
| 13 | |
---|
| 14 | if (strpos($matches[2], $NAMEverso) !== false) { |
---|
| 15 | $matches[3] = str_replace($NAMEverso, '', $matches[2]); |
---|
| 16 | # matches[3] = fichier sans verso |
---|
| 17 | |
---|
| 18 | // Image normale |
---|
| 19 | if (!file_exists($matches[1].'/thumbnail/verso')) { |
---|
| 20 | mkdir($matches[1].'/thumbnail/verso'); |
---|
| 21 | } |
---|
| 22 | 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].'"'); |
---|
| 23 | |
---|
| 24 | // Image hd |
---|
| 25 | if ($DIRhighORNOT) { |
---|
| 26 | if (!file_exists($matches[1].'/pwg_high/verso')) { |
---|
| 27 | mkdir($matches[1].'/pwg_high/verso'); |
---|
| 28 | } |
---|
| 29 | if ($DIMhdORNOT) { |
---|
| 30 | 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].'"'); |
---|
| 31 | } else { |
---|
| 32 | copy($FilesSource[$i], $matches[1].'/pwg_high/verso/'.$matches[3]); |
---|
| 33 | } |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | // Déplacement de l'image originale |
---|
| 37 | if ($MOVEverso) { |
---|
| 38 | $matches[4] = str_replace(substr($DIRsortie,0,-1), substr($DIRsource,0,-1), $matches[1]); |
---|
| 39 | # matches[4] = dossier source |
---|
| 40 | if (!file_exists($matches[4].'/verso')) { |
---|
| 41 | mkdir($matches[4].'/verso', 0777, true); |
---|
| 42 | } |
---|
| 43 | rename($matches[4].'/'.$matches[2], $matches[4].'/verso/'.$matches[3]); |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | $BlockNormal = true; |
---|
| 47 | $BlockThumbnail = true; |
---|
| 48 | $BlockHigh = true; |
---|
| 49 | } |
---|
| 50 | ?> |
---|