[9201] | 1 | <?php |
---|
| 2 | /***************************************\ |
---|
| 3 | | PHP OPTIMISATEUR | |
---|
[9276] | 4 | | Plugin Front2Back Support 1.1.a | |
---|
[9201] | 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 | |
---|
[9276] | 11 | $F2B_nameverso = $CONF['Plugins']['front2back_support']['NAMEverso']; // Suffixe des versions alternatives |
---|
| 12 | $F2B_moveverso = $CONF['Plugins']['front2back_support']['MOVEverso']; // Déplacer les images originales dans un sous dosssier 'verso' |
---|
[9201] | 13 | |
---|
[9276] | 14 | if (strpos($FileName, $F2B_nameverso) !== false) { |
---|
| 15 | $FileNameClean = str_replace($F2B_nameverso, '', $FileName); |
---|
[9201] | 16 | |
---|
| 17 | // Image normale |
---|
| 18 | if (!file_exists($FileFolder.'thumbnail/verso')) { |
---|
| 19 | mkdir($FileFolder.'thumbnail/verso'); |
---|
| 20 | } |
---|
[9276] | 21 | exec('include\nconvert.exe -q '.$CONF['Qnormal'].' -out jpeg -o "'.$FileFolder.'thumbnail/verso/'.$FileNameClean.'.jpg" -dpi 72 '.$CONF['convOptions'].' -resize '.$CONF['DIMnormal'].' '.$CONF['DIMnormal'].' '.$CONF['copyNormal'].' "'.$FilesSource[$i].'"'); |
---|
[9201] | 22 | |
---|
| 23 | // Image hd |
---|
| 24 | if ($CONF['DIRhighORNOT']) { |
---|
| 25 | if (!file_exists($FileFolder.'pwg_high/verso')) { |
---|
| 26 | mkdir($FileFolder.'pwg_high/verso'); |
---|
| 27 | } |
---|
| 28 | if ($CONF['DIMhdORNOT']) { |
---|
[9276] | 29 | exec('include\nconvert.exe -q '.$CONF['Qhd'].' -out jpeg -o "'.$FileFolder.'pwg_high/verso/'.$FileNameClean.'.jpg" -dpi '.$CONF['DPI'].' '.$CONF['convOptions'].' -resize '.$CONF['DIMhd'].' '.$CONF['DIMhd'].' '.$CONF['copyHD'].' "'.$FilesSource[$i].'"'); |
---|
| 30 | } else if (!in_array($FileExt, $CONF['JPGexts'])) { |
---|
| 31 | exec('include\nconvert.exe -q '.$CONF['Qhd'].' -out jpeg -o "'.$FileFolder.'pwg_high/'.$FileNameClean.'.jpg" "'.$FilesSource[$i].'"'); |
---|
[9201] | 32 | } else { |
---|
[9276] | 33 | copy($FilesSource[$i], $FileFolder.'pwg_high/verso/'.$FileNameClean.'.jpg'); |
---|
[9201] | 34 | } |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | // Déplacement de l'image originale |
---|
[9276] | 38 | if ($F2B_moveverso) { |
---|
[9201] | 39 | $FileFolderSource = str_replace($CONF['DIRsortie'], $CONF['DIRsource'], $FileFolder); |
---|
| 40 | if (!file_exists($FileFolderSource.'verso')) { |
---|
| 41 | mkdir($FileFolderSource.'verso', 0777, true); |
---|
| 42 | } |
---|
[9276] | 43 | rename($FileFolderSource.$FileName.'.'.$FileExt, $FileFolderSource.'verso/'.$FileNameClean.'.'.$FileExt); |
---|
[9201] | 44 | } |
---|
| 45 | |
---|
[9276] | 46 | // Suppression de la miniature si déjà crée (par un autre plugin) |
---|
| 47 | if (file_exists($FileFolder.'thumbnail/'.$CONF['prefixe_mini'].$FileName.'.jpg')) { |
---|
| 48 | unlink($FileFolder.'thumbnail/'.$CONF['prefixe_mini'].$FileName.'.jpg'); |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | $BlockNormal['front2back_support'] = true; |
---|
| 52 | $BlockThumbnail['front2back_support'] = true; |
---|
| 53 | $BlockHigh['front2back_support'] = true; |
---|
[9201] | 54 | } |
---|
| 55 | ?> |
---|