Image Couverture: Effacer:
Retour
Gougle! ";
if ($efface=="on") unlink("images/$dest.png");
// print "$dest";
if (file_exists("images/$dest.png")) print "Existant:";
if ($qid && $_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 = 300; $height = 400; $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); };