Image Logo: Effacer:
retour
";
if ($mid && $_FILES) {
	$tmpf=$_FILES['tmpfile']['tmp_name'];
	if (!$tmpf) { print "
choisissez une image jpeg/png/gif à envoyer"; exit; }; $finfo = finfo_open(FILEINFO_MIME); if (!preg_match("#image/(jpeg|png|gif);#",finfo_file($finfo, $tmpf),$res)) { print "fichier non supporté! $res[0]"; @unlink($tmpf); exit; }; finfo_close($finfo); $lim="imagecreatefrom".$res[1]; $img=$lim($tmpf); unlink($tmpf); $width = 150; $height = 100; $width_orig=imagesx($img); $height_orig=imagesy($img); $ratio_orig = $width_orig/$height_orig; if ($width/$height > $ratio_orig) { $width = $height*$ratio_orig; } else { $height = $width/$ratio_orig; } if ( ($width > $width_orig) && ($height > $height_orig) ) { // agrandissement pas bon $width=$width_orig; $height=$height_orig; }; // Resample $image_p = imagecreatetruecolor($width, $height); imagecopyresampled($image_p, $img, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); imagepng($image_p,"images/$dest.png") || print "échec de la création png"; print ""; chmod("images/$dest.png",0644); };