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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
| if (isset($_POST['auteur']) && isset($_POST['email'])){
$auteur = ADDSLASHES($_POST['auteur']);
$categorie = ADDSLASHES($_POST['categorie']);
$email = ADDSLASHES($_POST['email']);
$chemin = "Upload/Gallerie";
require_once "Include/cnx.inc.php";
require_once "Include/fonctions.inc.php";
$nbPhotos = 0 ;
foreach ($_FILES as $value)
{
$image = $value['tmp_name'];
if (est_image($image)){
// Redimmesionnement
$filename = $image;
list($width, $height) = getimagesize($filename); //on recup la taille de l'image original
if ($width > $height){ // mode paysage
if ($width > 900){
$newwidth = 900;
$newheight = (900*$height)/$width;
}
}
else{ // mode portrait
if ($height > 700){
$newheight = 700;
$newwidth = (700*$width)/$height;
}
}
$img_dst = imagecreatetruecolor( $newwidth, $newheight ); //on créer l'image destination
$img_src = imagecreatefromjpeg($filename);
imagecopyresized($img_dst, $img_src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagejpeg ( $img_dst , "Upload/Gallerie/".$img_dst."");
} // Fin if est_image
} // Fin for each
}
?> |
Partager