Désormais inutile

This commit is contained in:
LC 2023-10-22 00:48:59 +02:00
parent c948f09074
commit 0af2e0b99d
1 changed files with 0 additions and 81 deletions

View File

@ -1,81 +0,0 @@
<?php
/* création des miniatures @Lionel Croquefer 2019
* modification le 19 octobre 2023
*/
if (!isset($_GET['img']))
{
exit(0);
}
$img = '../../../'.$_GET['img'];
if ( is_file($img) && substr(mime_content_type($img), 0, 5) == 'image' ) {
function makeDir($dir) {
if ( (!is_dir($dir)) || (!file_exists($dir)) )
@mkdir($dir,0755,true);
}
// taille des miniatures
$tnlarge = 320;/*267*/
$tnhaut = ($tnlarge/1.6);/*200*/
$size_img = filesize($img);
$dossiercache = '../../../site/file/cache';
makeDir($dossiercache);
$par = substr(strrchr($img, '/'), 1);
$url_par = str_replace('/'.$par,'',$img);
$cache = substr(strrchr($url_par, '/'), 1);
makeDir($dossiercache.'/'.$cache);
$extension = strrchr($par,'.');
$vignette = str_replace($extension,'',$par);
$miniature = $dossiercache.'/'.$cache.'/tn-'.$vignette.'-'.$size_img.'.webp';
if (!file_exists($miniature)) {
list($width, $height, $type, $attr) = getimagesize($img);
if ($height > $tnhaut)
{
$convert = $tnhaut/$height;
$height = $tnhaut;
$width = ceil($width*$convert);
}
if ($width > $tnlarge)
{
$convert = $tnlarge/$width;
$width = $tnlarge;
$height = ceil($height*$convert);
}
$largeur = $width;
$hauteur = $height;
if($type == 1)
{
$img_in = imagecreatefromgif($img);
}
elseif($type == 2)
{
$img_in = imagecreatefromjpeg($img);
}
elseif($type == 3)
{
$img_in = imagecreatefrompng($img);
}
elseif($type == 18)
{
$img_in = imagecreatefromwebp($img);
}
imageinterlace($img_in, true);
$img_out = imagecreatetruecolor($largeur, $hauteur) or die ('Impossible de créer un flux d\'image GD');
imagecopyresampled($img_out, $img_in, 0, 0, 0, 0, imagesx($img_out), imagesy($img_out), imagesx($img_in), imagesy($img_in));
imagewebp($img_out, $miniature, 80);
imagedestroy($img_out);
}
header('Content-Type: image/webp');
$data = file_get_contents($miniature);
echo $data;
clearstatcache();
}
else {echo 'This is not an image';}
?>