Voilà ... j'ai 4 scripts : un pour uploader une image, l'autre pour la redimensionner correctement, un script d'affichage et enfin le formulaire dans lequel l'utilisateur entre ses données ... Le problème est : comment réussir à tout mélanger ... je n'en peux plus et celà fait 2 semaines que je me casse la tête ... Il faudrait que l'utilisateur envoie l'image, qu'elle soit redimensionnée et visible sur la partie prévisualisation de la page ... pour être finalement envoyé si tout lui plait ...
Impossible pour moi avec les photos ...
je craque, si quelqu'un peut me venir en aide ... Voilà tous les scripts :
FORMULAIRE :
<html>
<head>
<body>
<form name="newsletter" method="post" action="affiche.php">
<table align ="left">
<tr align ="center">
<FONT SIZE=4 COLOR="red" FACE="arial">
<u>Image </u>
<tr align ="left">
<textarea name="bloc1" cols="20" rows="10" style="font-weight:700; color:000000;"></textarea>
</tr>
<td>
</td>
<tr align ="center">
<FONT SIZE=4 COLOR="red" FACE="arial">
<u>Création </u>
</tr>
<tr align="left">
<textarea name="bloc2" cols="20" rows="10" style="font-weight:700; color:000000;"></textarea>
</tr>
</table>
<table align="right">
<tr align ="center">
<FONT SIZE=4 COLOR="red" FACE="arial">
<u>Promo </u>
</tr>
<tr>
</tr>
<tr>
</tr>
<FONT SIZE=4 COLOR="darkred" FACE="arial">
<tr>
</tr>
<center>Titre</center>
<tr>
<textarea name="bloc11" cols="30 " rows="2" ></textarea>
</tr>
<tr>
<textarea name="bloc12" cols="30 " rows="8" ></textarea>
</tr>
<tr align="center">
<textarea name="bloc13" cols="4" rows="2" style="font-weight:700; color:000000; font-family:verdana" ></textarea>
Prix
<tr>
</tr>
<tr>
</tr>
</tr>
<tr>
</tr>
<FONT SIZE=4 COLOR="darkred" FACE="arial">
<tr>
</tr>
<center>Titre</center>
<tr>
<textarea name="bloc14" cols="30 " rows="2" ></textarea>
</tr>
<tr>
<textarea name="bloc15" cols="30 " rows="8" ></textarea>
</tr>
<tr align="center">
<textarea name="bloc16" cols="4" rows="2" style="font-weight:700; color:000000; font-family:verdana" ></textarea>
Prix
<tr>
</tr>
<tr>
</tr>
</tr>
<tr>
</tr>
<FONT SIZE=4 COLOR="darkred" FACE="arial">
<tr>
</tr>
<center>Titre</center>
<tr>
<textarea name="bloc17" cols="30 " rows="2" ></textarea>
</tr>
<tr>
<textarea name="bloc18" cols="30 " rows="8" ></textarea>
</tr>
<tr align="center">
<textarea name="bloc19" cols="4" rows="2" style="font-weight:700; color:000000; font-family:verdana" ></textarea>
Prix
<tr>
</tr>
<tr>
</tr>
</tr>
<tr align ="center">
<FONT SIZE=4 COLOR="red" FACE="arial">
<tr>
</tr>
<u>Dossier du mois </u>
<tr>
<textarea name="bloc20" cols="30 " rows="8" ></textarea>
</tr>
</table>
<table align ="center">
<tr align="center>
</tr>
<td>
</td>
<tr align ="center">
<FONT SIZE=4 COLOR="red" FACE="arial">
<u>photo </u>
<tr>
<INPUT type="file" name="photo1"><BR><BR>
<INPUT type="submit" name="ok" value="redimensionner photo" action="redim.php"><BR><BR>
</tr>
<tr>
<Titre photo
</tr>
<tr>
</tr>
<tr>
</tr>
<tr align="center">
<textarea name="bloc3" cols="35" rows="2" style="font-weight:700; color:000000; font-family:verdana" ></textarea>
prix photo
<textarea name="bloc10" cols="5" rows="2" style="font-weight:700; color:000000; font-family:verdana"></textarea>
</td>
</tr>
<tr>
</tr>
<center>Titre</center>
<tr>
<td colspan="3" class="norm" align="center">
<textarea name="bloc4" cols="35" rows="2" style="font-weight:200; color:000000; font-family:verdana" ></textarea>
</td >
</tr>
<td colspan="3" class="norm" align="center">
<textarea name="bloc5" cols="61" rows="15" style="font-weight:200; color:000000; font-family:verdana" ></textarea>
</td >
<tr>
<INPUT type="file" name=" image"><BR><BR>
</tr>
<td>
</td>
<tr>
</tr>
<center>Titre</center>
<tr>
<td colspan="3" class="norm" align="center">
<textarea name="bloc7" cols="35" rows="2" style="font-weight:200; color:000000; font-family:verdana" ></textarea>
</td >
</tr>
<tr align="center">
<textarea name="bloc8" cols="61 " rows="15" style="font-weight:200; color:000000; font-family:verdana""></textarea>
</tr >
<tr>
<INPUT type="file" name=" image"><BR><BR>
</tr>
</table>
<table>
<td>
<tr align="center">
<INPUT type="submit" name="prev" value="previsualisation"><BR><BR>
</tr>
<tr align="center">
<INPUT type="submit" name="ok" value="envoyez" action="affiche.php"><BR><BR>
</tr>
</td>
</table>
</body>
</head>
</html>
(la mise en page n'est pas trop correcte mais toute la programmation se fait sous MAC au bloc note et c'est très difficile quand on est pas dedans depuis longtemps)
LA PAGE AFFICHAGE EN PHP
<?php
$bloc1=$_POST["bloc1"];
$bloc2=$_POST["bloc2"];
$bloc3=$_POST["bloc3"];
$bloc4=$_POST["bloc4"];
$bloc5=$_POST["bloc5"];
$bloc6=$_POST["bloc6"];
$bloc7=$_POST["bloc7"];
$bloc8=$_POST["bloc8"];
$bloc9=$_POST["bloc9"];
$bloc10=$_POST["bloc10"];
$bloc11=$_POST["bloc11"];
$bloc12=$_POST["bloc12"];
$bloc13=$_POST["bloc13"];
$bloc14=$_POST["bloc14"];
$bloc15=$_POST["bloc15"];
$bloc16=$_POST["bloc16"];
$bloc17=$_POST["bloc17"];
$bloc18=$_POST["bloc18"];
$bloc19=$_POST["bloc19"];
$bloc20=$_POST["bloc20"];
$photo1=$_POST["photo1"];
$photo2=$_POST["photo2"];
$photo3=$_POST["photo3"];
$photo4=$_POST["photo4"];
echo "<html><head>
<link href=\"news.css\" rel=\"stylesheet\" type=\"text/css\">
<div><img src=\"
[ Lien ]" style=\"position:absolute; top:0; left:0; width:800; height: 100;\"></div></head>";
echo"<body>
<div><img src=\"
[ Lien ]" style=\"position:absolute; top:120; left:0; width:150; height:20;\"></div>
<div name=bloc1 style=\"word-wrap:break-word; position:absolute; top:140; left:0; width:150; height:180;scrollbar:auto; border=2px solid #EAE9D9;\">
<p>$bloc1</p>
</div>
<div><img src=\"
[ Lien ]" style=\"position:absolute; top:350; left:0; width:150; height:20;\"></div>
<div name=\"bloc2\" style=\"position:absolute; top:370; left:0; width:150; height:180 ; scrollbar:auto; border=2px solid #EAE9D9;\">
<p>$bloc2</p>
</div>
<div name=\"bloc3\" style=\"position:absolute; top:120; left:200; width:400; height:20; scrollbar:auto; background:#EAE9D9;\">
<h1><center><b>$bloc3</center></b></h1>
</div>
<div style=\"position:absolute; top:140; left:200; width:400; height:250;border=2px solid #EAE9D9 ;\">
<img src=$photo1>
</div>
<div name=\"bloc10\" style=\"position:absolute; top:365; left:540; width:60; height:25; background:#A52A2A; scrollbar:auto; border=2px solid #EAE9D9;\">
<h4><center><b>$bloc10</center></b></h4>
</div>
<div name=bloc4 style=\"position:absolute; top:400; left:200; width:250; height:20; scrollbar:auto; background:#EAE9D9;\">
<h2><b>$bloc4</b></h2>
</div>
<div name=bloc5 style=\"position:absolute; top:420; left:200; width:250; height:130; scrollbar:auto;\">
<p>$bloc5</p>
</div>
<div name=bloc6 style=\"position:absolute; top:400; left:455; width:145; height:150; border=2px solid #EAE9D9;\">
<img src=$photo2>
</div>
<div name=bloc7 style=\"position:absolute; top:565; left:200; width:250; height:20; scrollbar:auto; background:#EAE9D9;\">
<h2><b>$bloc7</b></h2>
</div>
<div name=bloc8 style=\"position:absolute; top:585; left:200; width:250; height:130; scrollbar:auto;\">
<p>$bloc8</p>
</div>
<div name=bloc9 style=\"position:absolute; top:565; left:455; width:145; height:150; border=2px solid #EAE9D9;\">
<img src=$photo3>
</div>
<div><img src=\"
[ Lien ]" style=\"position:absolute; top:120; left:650; width:150; height:20;\"></div>
<div name=bloc11 style=\"position:absolute; top:160; left:650; width:150; height:20; border=2px solid #EAE9D9;\">
<p><b>$bloc11</b></p>
</div>
<div name=bloc12 style=\"position:absolute; top:180; left:650; width:150; height:80; scrollbar:auto; border=2px solid #EAE9D9;\">
<p>$bloc12</p>
</div>
<div name=bloc13 style=\"position:absolute; top:240; left:760; width:40; height:20; background:#A52A2A; border=2px solid #EAE9D9;\">
<h3><b><center>$bloc13</center></b></h3>
</div>
<div name=bloc14 style=\"position:absolute; top:275; left:650; width:150; height:20; border=2px solid #EAE9D9;\">
<p><b>$bloc14</b></p>
</div>
<div name=bloc15 style=\"position:absolute; top:295; left:650; width:150; height:80; scrollbar:auto; border=2px solid #EAE9D9;\">
<p>$bloc15</p>
</div>
<div name=bloc16 style=\"position:absolute; top:355; left:760; width:40; height:20; background:#A52A2A; scrollbar:auto; border=2px solid #EAE9D9;\">
<h3><b><center>$bloc16</center></b></h3>
</div>
<div name=bloc17 style=\"position:absolute; top:390; left:650; width:150; height:20; border=2px solid #EAE9D9;\">
<p><b>$bloc17</b></p>
</div>
<div name=bloc18 style=\"position:absolute; top:410; left:650; width:150; height:80; scrollbar:auto; border=2px solid #EAE9D9;\">
<p>$bloc18</p>
</div>
<div name=bloc19 style=\"position:absolute; top:470; left:760; width:40; height:20; background:#A52A2A; border=2px solid #EAE9D9;\">
h3><b><center>$bloc19</center></b></h3>
</div>
<div> <img src=\"
[ Lien ]" style=\"position:absolute; top:515; left:650; width:150; height:20;\">
</div>
<div name=bloc20 style=\"position:absolute; top:535; left:650; width:150; height:150; border=2px solid darkred; scrollbar:auto;\">
<p>$bloc20</p>
</div>
<div name=photo4 style=\"position:absolute; top:585; left:650; width:150; height:250; border=2px solid darkred; scrollbar:auto;\">
<img src=$photo4>
</div>
</body>";
echo"</html>";
>
LA FONCTION REDIMENSIONNEMENT DE L'IMAGE
<?php
$affiche=200;
$image='hiver.jpg';
if (!file_exists($image))
{
}
else
{
$taille=getimagesize($image);
$largeur=$taille[0];
$hauteur=$taille[1];
//image verticale ou carrée
if ($hauteur>=$largeur)
{
$hauteur2=$affiche;
$largeur2=round(($hauteur2/$hauteur)*$largeur);
}
//image horizontale ou carrée
else
{
$largeur2=$affiche;
$hauteur2=round(($largeur2/$largeur)*$hauteur);
}
}
echo"
<img border='0' src='$image' width='$largeur2' height='$hauteur2' >
";
?>
LA FONCTION UPLOAD DE L'IMAGE
<?php
$path = "pics";
$MaxSize = 1000000;
$ValidType = array("image/gif"=>"gif","image/pjpeg"=>"jpg","image/jpeg"=>"jpg","image/png"=>"png");
if(!isset($_FILES['fichier'])) exit("Fichier absent");
if($_FILES['fichier']['size'] > $MaxSize) exit("Image trop lourde");
$ext = "";
foreach($ValidType as $k => $v) if($_FILES['fichier']['type'] == $k) $ext = $v;
if(empty($ext)) exit("Type de fichier invalide");
$liste = "abcdefghijklmnopqrstuvwxyz0123456789";
$NomImage = "";
while(strlen($NomImage) != 8) $NomImage .= $liste[rand(0,35)];
if(!move_uploaded_file($_FILES['fichier']['tmp_name'], $path."/".$NomImage.".".$ext)) exit("l'upload a echoue");
else
{
echo "<img src=\"".$path."/".$NomImage.".".$ext."\">";
}
?>
-----------------------
J'espère que vous pourriez m'aider ... j'en peux plus ...
J'attends vos réponses en espérant de tout coeur que vous m'aiderez ...
Si le script contient des erreurs, dites le moi ... il doit y en avoir plus d'une ...



Help ...