[PHP] Problème

curiosité _info Messages postés 166 Date d'inscription   Statut Membre Dernière intervention   -  
curiosité _info Messages postés 166 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,
Bonjour ,
Veuillez M'aidez A résoudre mon problème :

J'ai réaliser un mini site qui permet de mettre une image que l'utilisateur upload dans un endroit précis qui
J'ai fait le modèle Wanted Qui met une photo que le visiteur envoie dans un endroit dans l'image originale qui est ici :

j'ai fait ce script qui n'affiche rien dans la fin !!
Le mini Site se compose de 4 scripts PHP:
Le mini Site :

selectionner_image.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
<link href="feuille_de_style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<p class="grand_titre"><span class="petit_titre">Etape 1 : Séléctionnez Un Modèle</span></p>
<p> </p>
<table width="269" height="288" border="1">
<a href="image_par_modele.php?modele=images/wanted.jpg"><tr>
<td width="259" height="256"><p><span class="modele" style="font-size: x-large">Modèle 1: </span> <span style="font-size: x-large">Wanted</span></p>
<p><img src="images/wanted.jpg" width="269" height="368" align="middle" longdesc="file:///E|/Documents and Settings/Administrateur/Bureau/Create Image.com/wanted.jpg" /></p></td>
</tr></a>
</table>
</body>
</html>


image_par_modele.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
<link href="feuille_de_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<p class="grand_titre"><span class="petit_titre">Etape 2 : Envoyez Votre Image Et Ecrire le Texte
Sur L'image</span></p>
<p> </p>
<p class="modele">Vous Avez Sélectionné Ce Modèle :</p>
<table width="200" border="1" align="center">
<tr>
<td>
<?php
$modele = $_GET['modele'];?>
<img src="$modele" width="250" height="300" /></td>
</tr>
</table>
<p> </p>
<form action="image_up.php" method="post" enctype="multipart/form-data"><p><span style="font-weight: bold; font-style: italic; font-family: 'Comic Sans MS', cursive;">Sélectionnez Une image De Votre Bureau : </span>
<input name="image_up" type="file" />
</p>
<p><span style="font-weight: bold; font-style: italic; font-family: 'Comic Sans MS', cursive;">Le Texte à écrire (ne dépasse pas 15 caractéres) : </span>
<input name="texte" type="text" /></p>
<p>
<input name="modele" type="hidden" <?php echo 'value="' .$_GET['modele']. '"'; ?> />
</p>
<p style="text-align: center">
<input name="envoyer" type="submit" class="grand_titre" value="Envoyer !!" /></form>
 
</body>
</html>

image_up.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
<link href="feuille_de_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<p>
<?php
// Testons si le fichier a bien été envoyé et s'il n'y a pas d'erreur
if (isset($_FILES['image_up']) AND $_FILES['image_up']['error'] == 0)
{
// Testons si le fichier n'est pas trop gros
if ($_FILES['image_up']['size'] <= 1000000)
{
// Testons si l'extension est autorisée
$infosfichier = pathinfo($_FILES['image_up']['name']);
$extension_upload = $infosfichier['extension'];
$extensions_autorisees = array('jpg', 'jpeg', 'gif', 'png');
if (in_array($extension_upload, $extensions_autorisees))
{
// On peut valider le fichier et le stocker définitivement
move_uploaded_file($_FILES['image_up']['tmp_name'], 'uploads/' . basename($_FILES['image_up']['name']));
echo "L'envoi de l'image a été bien effectué !";
}
}
}?>
<form action="image_finale.php" method="post" class="signature">
<p>
<input name="mod" type="hidden" <?php echo 'value="' .$_POST['modele']. '"'; ?> />
<input name="destin" type="hidden" <?php echo 'value="' .'uploads/' . basename($_FILES['image_up']['name']). '"'; ?> />
</p>
<p><input name="envoyer" type="submit" class="bouton_creer_image" value="Passez Au Résultat Final" />  </p>
</form>
</body>
</html>

et enfin
image_finale.php
<?php
if($_POST['mod'] == 'images/wanted.jpg')
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
</head>
<body>
<?php
header ("Content-type: image/jpeg"); // L'image que l'on va créer est un jpeg
$destin = $_POST['mod'];
$sour = $_POST['destin'];
$source = imagecreatefrompng("$sour"); // Le logo est la source
$destination = imagecreatefromjpeg("$destin"); // La photo est la destination


imagecopymerge($destination, $source, 66,62,178,73, 400, 500);

imagejpeg($destination);
?>

</body>
</html>
<?php }?>

Le Résultat :



Merci D'avance !!
A voir également:

3 réponses

Zep3k!GnO Messages postés 2025 Date d'inscription   Statut Membre Dernière intervention   200
 
dans ton script image_up.php, tu utilises $_FILES, mais dans tes formulaires il n'y a aucun <input type="file"/> donc t'envoies pas l'image la....
Renseignes toi sur google sur l'upload d'image et PhP ;)

Attention a DreamWeaver (je suppose que t'as utilisé ça vu l'code... ) car ça sort des trucs super cheap comme ta ligne :
<img src="images/wanted.jpg" width="269" height="368" align="middle" longdesc="file:///E|/Documents and Settings/Administrateur/Bureau/Create Image.com/wanted.jpg" />

Le longdesc est tout simplement... inutile, dénué de sens.

0
giheller Messages postés 1882 Date d'inscription   Statut Membre Dernière intervention   142
 
bonsoir,

d'autre part,

move_uploaded_file($_FILES['image_up']['tmp_name'], 'uploads/' . basename($_FILES['image_up']['name']));
echo "L'envoi de l'image a été bien effectué !";


ne veut absolument pas dire que l'envoi a été fait.
pour cela il faut faire

if (move_upload ......) {echo "L'envoi de l'image a été bien effectué !"; }
else {echo "problème lors de l'envoi de l'image."; }
0
curiosité _info Messages postés 166 Date d'inscription   Statut Membre Dernière intervention   8
 
@Zep3k!GnO :
image_par_modele.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
<link href="feuille_de_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<p class="grand_titre"><span class="petit_titre">Etape 2 : Envoyez Votre Image Et Ecrire le Texte
Sur L'image</span></p>
<p> </p>
<p class="modele">Vous Avez Sélectionné Ce Modèle :</p>
<table width="200" border="1" align="center">
<tr>
<td>
<?php
$modele = $_GET['modele'];?>
<img src="$modele" width="250" height="300" /></td>
</tr>
</table>
<p> </p>
<form action="image_up.php" method="post" enctype="multipart/form-data"><p><span style="font-weight: bold; font-style: italic; font-family: 'Comic Sans MS', cursive;">Sélectionnez Une image De Votre Bureau : </span>
<input name="image_up" type="file" />
</p>
<p><span style="font-weight: bold; font-style: italic; font-family: 'Comic Sans MS', cursive;">Le Texte à écrire (ne dépasse pas 15 caractéres) : </span>
<input name="texte" type="text" /></p>
<p>
<input name="modele" type="hidden" <?php echo 'value="' .$_GET['modele']. '"'; ?> />
</p>
<p style="text-align: center">
<input name="envoyer" type="submit" class="grand_titre" value="Envoyer !!" /></form>

</body>
</html>
0