<?php
$repertoire = openDir(".");
while ($rep = readDir($repertoire)) {
if (($rep != ".")&&($rep != "..")&&($rep != "trim.php")&&(!is_dir($rep))&&($rep!="Thumbs.db")) {
if(!is_dir($y.$rep)){
$imageSource=imagecreatefromjpeg($rep);
$tx=imagesx($imageSource);
if($tx>500){ //test si l'image est supérieur à 500px en largeur
$ratio=(float)imagesx($imageSource)/(float)imagesy($imageSource);
$x=200; //met la taille voulu ici, remplace le 200 en dessous aussi.
$y=200/$ratio;
$imageDestination=imagecreatetruecolor( $x, $y);
imagecopyresampled ($imageDestination, $imageSource, 0, 0, 0, 0 ,$x, $y, imagesx($imageSource), imagesy($imageSource));
imagejpeg($imageDestination, "tn/".$rep);
echo $rep.' rétréci ! <br>';
}
}
}
}
closeDir($repertoire);
?>

Nous - Plan du site - Informations légale - Contact - © Graphiks.net