1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
$lv = $_POST['tab'];
$temp = explode(",",$lv);
settype($temp[1],'integer');
$sortie = imagecreatetruecolor($_POST['largeur'],$_POST['hauteur']);
$k = 0;
for($i=0; $i<$_POST['largeur']; $i++){
for($j=0; $j<$_POST['hauteur']; $j++){
imagesetpixel($sortie,$j,$i,$temp[$k]);
$k++;
}
}
$tracer="affichage de l'image";
$largeurDestination = 70;
$hauteurDestination = 70;
$im = ImageCreateTrueColor ($largeurDestination, $hauteurDestination)
or die ("Erreur lors de la création de l'image");
$largeurSource = imagesx($sortie);
$hauteurSource = imagesy($sortie);
if($largeurSource>$hauteurSource)
{
$distx=($largeurSource-$hauteurSource)/2;
$disty=0;
$largeurSource=$hauteurSource;
}else
{
$disty=($hauteurSource-$largeurSource)/2;
$distx=0;
$hauteurSource=$largeurSource;
}
ImageCopyResampled($im, $sortie, 0, 0, $distx, $disty, $largeurDestination, $hauteurDestination, $largeurSource, $hauteurSource);
$miniature = "mini/".$_POST['nom'];
ImageJpeg ($im, $miniature);
$tracer=$miniature; |
Partager