probleme sous ie avec mon scripte php

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : probleme sous ie avec mon scripte php

Probleme sous ie avec mon scripte php

par Chinese75 » 05 avr. 2011, 12:33

Bonjour,

Je viens de comprendre à quoi servait ton script...

C'est un script d'affichage DPE (Bilan Diagnostic énergetique) pour les agents immobilier.

Ca serait super si tu packagais ces sources dans un ZIP et que tu le partages...

Beaucoup de gens sont ennuyés ces derniers temps avec ca... à commencer par moi ^^ :D

Bises à la communauté PHPFrance !

Nico

Re: probleme sous ie avec mon scripte php

par baka54 » 03 févr. 2011, 21:30

Bonsoir :) et merci pour votre aide sur mon projet,
je l'es enfin terminé grâce a vous, et, je vous en remercie de votre aide.
Et encore merci :)

Re: probleme sous ie avec mon scripte php

par moogli » 03 févr. 2011, 15:43

vire le include dans le code formulaire :)


@+

Re: probleme sous ie avec mon scripte php

par baka54 » 03 févr. 2011, 14:07

Merci pour ton aide :)
maintenant j'ai un result mais avant le resultat j'ai ce message d'erreur :
Warning: Cannot modify header information - headers already sent by (output started at /homepages/36/d267091730/htdocs/sites/jerome/teste/new/index.php:15) in /homepages/36/d267091730/htdocs/sites/jerome/teste/new/teste3.php on line 63
(l'erreur de la ligne 63 dépend en faite de la valeur entrée, mais cela se rapport toujours a un problème de "header")
<?php
if($_GET['dpe']>=0 && $_GET['dpe']<=50)      {
  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);
  $fichier="images/1.jpg";
  $im = ImageCreateFromJpeg ($fichier);
  $text_color = imagecolorallocate ($im, 255,255,255);
  imagestring ($im, $font, 398, 76,  $_GET['dpe'], $text_color);
 header("Content-type: image/jpeg");
 imagejpeg ($im);
 echo "<img src=\"teste3.php?dpe={$_GET['dpe']}\" />";
   imagedestroy($im);
}
elseif($_GET['dpe']>=51 && $_GET['dpe']<=90){
  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);
  $fichier="images/2.jpg";
  $im = ImageCreateFromJpeg ($fichier);
  $text_color = imagecolorallocate ($im, 255,255,255);
  imagestring ($im, $font, 398, 122,  $_GET['dpe'], $text_color);
 header("Content-type: image/jpg");
 imagejpeg ($im);
 echo "<img src=\"teste3.php?dpe={$_GET['dpe']}\" />";
   imagedestroy($im);
}
elseif($_GET['dpe']>=91 && $_GET['dpe']<=150){
  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);
  $fichier="images/3.jpg";
  $im = ImageCreateFromJpeg ($fichier);
  $text_color = imagecolorallocate ($im, 255,255,255);
  imagestring ($im, $font, 398, 172,  $_GET['dpe'], $text_color);
 header("Content-type: image/jpg");
 imagejpeg ($im);
 echo "<img src=\"teste3.php?dpe={$_GET['dpe']}\" />";
   imagedestroy($im);
}
elseif($_GET['dpe']>=151 && $_GET['dpe']<=230){
  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);
  $fichier="images/4.jpg";
  $im = ImageCreateFromJpeg ($fichier);

  $text_color = imagecolorallocate ($im, 255,255,255);
   imagestring ($im, $font, 398, 216,  $_GET['dpe'], $text_color);
 header("Content-type: image/jpg");
 imagejpeg ($im);
 echo "<img src=\"teste3.php?dpe={$_GET['dpe']}\" />";
   imagedestroy($im);
    }
else if($_GET['dpe']>=231 && $_GET['dpe']<=330){
  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);
  $fichier="images/5.jpg";
  $im = ImageCreateFromJpeg ($fichier);
  $text_color = imagecolorallocate ($im, 255,255,255);
   imagestring ($im, $font, 398, 262,  $_GET['dpe'], $text_color);
header("Content-type: image/jpg");
imagejpeg ($im);
echo "<img src=\"teste3.php?dpe={$_GET['dpe']}\" />";
   imagedestroy($im);
}  
elseif($_GET['dpe']>=331 && $_GET['dpe']<=450){
  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);
  $fichier="images/6.jpg";
  $im = ImageCreateFromJpeg ($fichier);
  $text_color = imagecolorallocate ($im, 255,255,255);
   imagestring ($im, $font, 398, 306,  $_GET['dpe'], $text_color);
 header("Content-type: image/jpg");
 imagejpeg ($im);
 echo "<img src=\"teste3.php?dpe={$_GET['dpe']}\" />";
   imagedestroy($im);
    }          
else {
  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);
  $fichier="images/7.jpg";
  $im = ImageCreateFromJpeg ($fichier);
  $text_color = imagecolorallocate ($im, 255,255,255);
   imagestring ($im, $font, 398, 355,  $_GET['dpe'], $text_color);
 header("Content-type: image/jpg");
 imagejpeg ($im);
 echo "<img src=\"teste3.php?dpe={$_GET['dpe']}\" />";
   imagedestroy($im);
}
?>
<!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>
<link rel="stylesheet" href="http://localhost/dpe/css/template.css" type="text/css" />
</head>
<body>
<div class="php">
<form action="" method="get">

<input type="text" name="dpe" />

<input type="submit" value="valider" />

</form>
<?php
if (!empty($_GET['dpe'])) {
        include 'teste3.php';
        
}
?>
</div>
</body>
</html>
Merci encore pour votre aide :oops:

Re: probleme sous ie avec mon scripte php

par xTG » 03 févr. 2011, 09:54

echo "<img src=\"teste3.php?dpe={$_GET['dpe']}\" />";
;)

Re: probleme sous ie avec mon scripte php

par baka54 » 03 févr. 2011, 02:29

Voila un formulaire comme je le souhaite et qui fonctionne à 100% merci :)
En effet l'utilisation du fichier était en faite un teste pour vérifié le bon fonctionnement du formulaire et du résultat surtout,
J'ai fait se que tu m'a dit pour éviter une image pour x personne(s) et au bonheur la chance celui qui la en premier :s:
<?php
if($_GET['dpe']>=0 && $_GET['dpe']<=50)      {
  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);
  $fichier="images/1.jpg";
  $im = ImageCreateFromJpeg ($fichier);
  $text_color = imagecolorallocate ($im, 255,255,255);
  imagestring ($im, $font, 398, 76,  $_GET['dpe'], $text_color);
  header("Content-type: image/jpeg");
  imagejpeg ($im);

  imagedestroy($im);
}
elseif($_GET['dpe']>=51 && $_GET['dpe']<=90){
  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);
  $fichier="images/2.jpg";
  $im = ImageCreateFromJpeg ($fichier);
  $text_color = imagecolorallocate ($im, 255,255,255);
  imagestring ($im, $font, 398, 122,  $_GET['dpe'], $text_color);
  header("Content-type: image/jpg");
  imagejpeg ($im);

  imagedestroy($im);
}
elseif($_GET['dpe']>=91 && $_GET['dpe']<=150){
  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);
  $fichier="images/3.jpg";
  $im = ImageCreateFromJpeg ($fichier);
  $text_color = imagecolorallocate ($im, 255,255,255);
  imagestring ($im, $font, 398, 172,  $_GET['dpe'], $text_color);
  header("Content-type: image/jpg");
  imagejpeg ($im);

  imagedestroy($im);
}
elseif($_GET['dpe']>=151 && $_GET['dpe']<=230){
  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);
  $fichier="images/4.jpg";
  $im = ImageCreateFromJpeg ($fichier);

  $text_color = imagecolorallocate ($im, 255,255,255);
   imagestring ($im, $font, 398, 216,  $_GET['dpe'], $text_color);
  header("Content-type: image/jpg");
  imagejpeg ($im);
  
  imagedestroy($im);
    }
else if($_GET['dpe']>=231 && $_GET['dpe']<=330){
  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);
  $fichier="images/5.jpg";
  $im = ImageCreateFromJpeg ($fichier);
  $text_color = imagecolorallocate ($im, 255,255,255);
   imagestring ($im, $font, 398, 262,  $_GET['dpe'], $text_color);

  header("Content-type: image/jpg");
  imagejpeg ($im);
  
  imagedestroy($im);
}  
elseif($_GET['dpe']>=331 && $_GET['dpe']<=450){
  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);
  $fichier="images/6.jpg";
  $im = ImageCreateFromJpeg ($fichier);

  $text_color = imagecolorallocate ($im, 255,255,255);


   imagestring ($im, $font, 398, 306,  $_GET['dpe'], $text_color);

  header("Content-type: image/jpg");
  imagejpeg ($im);

  imagedestroy($im);
    }          
else {
  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);
  $fichier="images/7.jpg";
  $im = ImageCreateFromJpeg ($fichier);

  $text_color = imagecolorallocate ($im, 255,255,255);
   imagestring ($im, $font, 398, 355,  $_GET['dpe'], $text_color);

  header("Content-type: image/jpg");
  imagejpeg ($im);

  imagedestroy($im);
}
?>
et
<!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>
<link rel="stylesheet" href="http://localhost/dpe/css/template.css" type="text/css" />
</head>
<body>
<div class="php">
<form action="" method="get">

<input type="text" name="dpe" />

<input type="submit" value="valider" />

</form>
<?php
if (!empty($_GET['dpe'])) {
        include 'teste3.php';
        echo '<img src="teste3.php?dpe=$_GET['dpe']" />';
}
?>
</div>
</body>
</html>
et la par contre il me met une erreur:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /homepages/36/d267091730/htdocs/sites/jerome/teste/new/index.php on line 18

Re: probleme sous ie avec mon scripte php

par moogli » 02 févr. 2011, 23:19

Bon j'ai repris ton code d'un bout a l'autre parce qu'il y avait des choses que je n'avais pas prévue.

donc faut enlever les imagejpeg($im); qui font double emploi avec celui d'en dessous.
j'ai corrigé les else if qui sont des elseif (la différence c'est qu'a chaque fois tu fait un if dans un else et non une alternative au 1er if).

j'ai aussi virer les headers qui ne servent pas puisse que enregistre l'image sur le disque.
d'ailleur je ne pense pas que cela soit à conseiller car si plusieurs personnes utilise le script en même temps qui va avoir la bonne image ?

pour cela il faut utiliser le script comme je te l'ai indiqué au départ et dans ce cas garder les headers et les imagejpg($im) mais pas les imagejpeg ($im, 'resultat.jpg', 100); (qui enregistre le fichier).

donc dans ce cas tu ferais <img src="teste3.php?dpe=$_GET['dpe']" /> et la plus de soucis d'image sur le serveur.
le formulaire
<!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>
<link rel="stylesheet" href="http://localhost/dpe/css/template.css" type="text/css" />
</head>
<body>
<div class="php">
<form action="" method="get">

<input type="text" name="dpe" />

<input type="submit" value="valider" />

</form>
<?php
if (!empty($_GET['dpe'])) {
	include 'teste3.php';
	ech
	echo '<img src="resultat.jpg" /><br />clique <a href="resultat.jpg">ici</a> pour telecharger l\'image.';
}
?>
</div>
</body>
</html>
le code qui génère l'image
<?php
if($_GET['dpe']>=0 && $_GET['dpe']<=50)      {
  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);
  $fichier="images/1.jpg";
  $im = ImageCreateFromJpeg ($fichier);
  $text_color = imagecolorallocate ($im, 255,255,255);
  imagestring ($im, $font, 398, 76,  $_GET['dpe'], $text_color);
  //header("Content-type: image/jpeg");
  ////imagejpeg ($im);
  imagejpeg ($im, 'resultat.jpg', 100);
  imagedestroy($im);
}
elseif($_GET['dpe']>=51 && $_GET['dpe']<=90){
  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);
  $fichier="images/2.jpg";
  $im = ImageCreateFromJpeg ($fichier);
  $text_color = imagecolorallocate ($im, 255,255,255);
  imagestring ($im, $font, 398, 122,  $_GET['dpe'], $text_color);
  //header("Content-type: image/jpg");
  //imagejpeg ($im);
  imagejpeg ($im, 'resultat.jpg', 100);
  imagedestroy($im);
}
elseif($_GET['dpe']>=91 && $_GET['dpe']<=150){
  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);
  $fichier="images/3.jpg";
  $im = ImageCreateFromJpeg ($fichier);
  $text_color = imagecolorallocate ($im, 255,255,255);
  imagestring ($im, $font, 398, 172,  $_GET['dpe'], $text_color);
  //header("Content-type: image/jpg");
  //imagejpeg ($im);
  imagejpeg ($im, 'resultat.jpg', 100);
  imagedestroy($im);
}
elseif($_GET['dpe']>=151 && $_GET['dpe']<=230){
  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);
  $fichier="images/4.jpg";
  $im = ImageCreateFromJpeg ($fichier);

  $text_color = imagecolorallocate ($im, 255,255,255);
   imagestring ($im, $font, 398, 216,  $_GET['dpe'], $text_color);
  //header("Content-type: image/jpg");
  //imagejpeg ($im);
    imagejpeg ($im, 'resultat.jpg', 100);
  imagedestroy($im);
    }
else if($_GET['dpe']>=231 && $_GET['dpe']<=330){
  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);
  $fichier="images/5.jpg";
  $im = ImageCreateFromJpeg ($fichier);
  $text_color = imagecolorallocate ($im, 255,255,255);
   imagestring ($im, $font, 398, 262,  $_GET['dpe'], $text_color);

  //header("Content-type: image/jpg");
  //imagejpeg ($im);
    imagejpeg ($im, 'resultat.jpg', 100);
  imagedestroy($im);
}  
elseif($_GET['dpe']>=331 && $_GET['dpe']<=450){
  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);
  $fichier="images/6.jpg";
  $im = ImageCreateFromJpeg ($fichier);

  $text_color = imagecolorallocate ($im, 255,255,255);


   imagestring ($im, $font, 398, 306,  $_GET['dpe'], $text_color);

   //header("Content-type: image/jpg");
  //imagejpeg ($im);
  imagejpeg ($im, 'resultat.jpg', 100);
  imagedestroy($im);
    }          
else {
  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);
  $fichier="images/7.jpg";
  $im = ImageCreateFromJpeg ($fichier);

  $text_color = imagecolorallocate ($im, 255,255,255);
   imagestring ($im, $font, 398, 355,  $_GET['dpe'], $text_color);

  //header("Content-type: image/jpg");
  //imagejpeg ($im);
  imagejpeg ($im, 'resultat.jpg', 100);
  imagedestroy($im);
}
?>
@+

Re: probleme sous ie avec mon scripte php

par baka54 » 02 févr. 2011, 20:09

oups désolé je remet cela en forme :$

le voici :
pour le HTML :
<!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>
<link rel="stylesheet" href="http://localhost/dpe/css/template.css" type="text/css" />
</head>
<body>
<div class="php">
<form action="teste3.php" method="post">

<input type="text" name="dpe" />

<input type="submit" value="valider" />

</form>

<img src="teste3.php<?php if (empty($_POST['dpe'])) echo '?dpe='.$_POST['dpe']; ?>" />
<br />clique <a href='resultat.jpg'>ici</a> pour telecharger l'image.
</div>
</body>
</html>
Pour le PHP:
<?php
if($_GET['dpe']>=0 && $_GET['dpe']<=50)      
    {


  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);


  $fichier="images/1.jpg";
  $im = ImageCreateFromJpeg ($fichier);

  $text_color = imagecolorallocate ($im, 255,255,255);


  imagestring ($im, $font, 398, 76,  $_GET['dpe'], $text_color);

  header("Content-type: image/jpeg");
  imagejpeg ($im); 
  imagejpeg ($im, 'resultat.jpg', 100); 
  imagedestroy($im);
	}
else if($_GET['dpe']>=51 && $_GET['dpe']<=90) 
    {

  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);


  $fichier="images/2.jpg";
  $im = ImageCreateFromJpeg ($fichier);

  $text_color = imagecolorallocate ($im, 255,255,255);
  imagestring ($im, $font, 398, 122,  $_GET['dpe'], $text_color);

  header("Content-type: image/jpg");
  imagejpeg ($im); 
  imagejpeg ($im, 'resultat.jpg', 100); 
  imagedestroy($im);
	}
else if($_GET['dpe']>=91 && $_GET['dpe']<=150) 
    {



  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);


  $fichier="images/3.jpg";
  $im = ImageCreateFromJpeg ($fichier);

  $text_color = imagecolorallocate ($im, 255,255,255);


   imagestring ($im, $font, 398, 172,  $_GET['dpe'], $text_color);

  header("Content-type: image/jpg");
  imagejpeg ($im);
    imagejpeg ($im, 'resultat.jpg', 100); 
  imagedestroy($im);
    }
else if($_GET['dpe']>=151 && $_GET['dpe']<=230) 
    {


  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);

  $fichier="images/4.jpg";
  $im = ImageCreateFromJpeg ($fichier);

  $text_color = imagecolorallocate ($im, 255,255,255);

   imagestring ($im, $font, 398, 216,  $_GET['dpe'], $text_color);
  header("Content-type: image/jpg");
  imagejpeg ($im);
    imagejpeg ($im, 'resultat.jpg', 100); 
  imagedestroy($im);
    }
else if($_GET['dpe']>=231 && $_GET['dpe']<=330) 
    {



  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);


  $fichier="images/5.jpg";
  $im = ImageCreateFromJpeg ($fichier);

  $text_color = imagecolorallocate ($im, 255,255,255);


   imagestring ($im, $font, 398, 262,  $_GET['dpe'], $text_color);

  header("Content-type: image/jpg");
  imagejpeg ($im);
    imagejpeg ($im, 'resultat.jpg', 100); 
  imagedestroy($im);
    }	
else if($_GET['dpe']>=331 && $_GET['dpe']<=450) 
    {



  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);


  $fichier="images/6.jpg";
  $im = ImageCreateFromJpeg ($fichier);

  $text_color = imagecolorallocate ($im, 255,255,255);


   imagestring ($im, $font, 398, 306,  $_GET['dpe'], $text_color);

   header("Content-type: image/jpg");
  imagejpeg ($im);
  imagejpeg ($im, 'resultat.jpg', 100); 
  imagedestroy($im);
    }		
else                                
    {



  $font  = 18;
  $width  = ImageFontWidth($font) * strlen($_GET['dpe']);
  $height = ImageFontHeight($font);


  $fichier="images/7.jpg";
  $im = ImageCreateFromJpeg ($fichier);

  $text_color = imagecolorallocate ($im, 255,255,255);


   imagestring ($im, $font, 398, 355,  $_GET['dpe'], $text_color);

  header("Content-type: image/jpg");
  imagejpeg ($im);
  imagejpeg ($im, 'resultat.jpg', 100); 
  imagedestroy($im);
    }
?>

Re: probleme sous ie avec mon scripte php

par stealth35 » 02 févr. 2011, 19:54

met ton code entre balise (bouton PHP)

Re: probleme sous ie avec mon scripte php

par baka54 » 02 févr. 2011, 19:50

Re et merci pour ces indications,
J'ai fais les modifications données et je doit avoir mal gérer mon truc car d'une par les nombre n'apparais plus et sous ie au peut importe le nombre entrer toujours pas de chiffre mais pas de changement d'image non plus :s
Je suis un boulet du php :s voila les modification apporter:

HTLM


<!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>
<link rel="stylesheet" href="http://localhost/dpe/css/template.css" type="text/css" />
</head>
<body>
<div class="php">
<form action="teste3.php" method="post">
<input type="text" name="dpe" />
<input type="submit" value="valider" />
</form>
<img src="teste3.php<?php if (empty($_POST['dpe'])) echo '?dpe='.$_POST['dpe']; ?>" />
<br />clique <a href='resultat.jpg'>ici</a> pour telecharger l'image.
</div>
</body>
</html>

PHP:

<?php
if($_GET['dpe']>=0 && $_GET['dpe']<=50)
{
$font = 18;
$width = ImageFontWidth($font) * strlen($_GET['dpe']);
$height = ImageFontHeight($font);
$fichier="images/1.jpg";
$im = ImageCreateFromJpeg ($fichier);
$text_color = imagecolorallocate ($im, 255,255,255);
imagestring ($im, $font, 398, 76, $_GET['dpe'], $text_color);
header("Content-type: image/jpeg");
imagejpeg ($im);
imagejpeg ($im, 'resultat.jpg', 100);
imagedestroy($im);
}
else if($_GET['dpe']>=51 && $_GET['dpe']<=90)
{
$font = 18;
$width = ImageFontWidth($font) * strlen($_GET['dpe']);
$height = ImageFontHeight($font);
$fichier="images/2.jpg";
$im = ImageCreateFromJpeg ($fichier);
$text_color = imagecolorallocate ($im, 255,255,255);
imagestring ($im, $font, 398, 122, $_GET['dpe'], $text_color);
header("Content-type: image/jpg");
imagejpeg ($im);
imagejpeg ($im, 'resultat.jpg', 100);
imagedestroy($im);
}
else if($_GET['dpe']>=91 && $_GET['dpe']<=150)
{
$font = 18;
$width = ImageFontWidth($font) * strlen($_GET['dpe']);
$height = ImageFontHeight($font);
$fichier="images/3.jpg";
$im = ImageCreateFromJpeg ($fichier);
$text_color = imagecolorallocate ($im, 255,255,255);
imagestring ($im, $font, 398, 172, $_GET['dpe'], $text_color);
header("Content-type: image/jpg");
imagejpeg ($im);
imagejpeg ($im, 'resultat.jpg', 100);
imagedestroy($im);
}
else if($_GET['dpe']>=151 && $_GET['dpe']<=230)
{
$font = 18;
$width = ImageFontWidth($font) * strlen($_GET['dpe']);
$height = ImageFontHeight($font);
$fichier="images/4.jpg";
$im = ImageCreateFromJpeg ($fichier);
$text_color = imagecolorallocate ($im, 255,255,255);
imagestring ($im, $font, 398, 216, $_GET['dpe'], $text_color);
header("Content-type: image/jpg");
imagejpeg ($im);
imagejpeg ($im, 'resultat.jpg', 100);
imagedestroy($im);
}
else if($_GET['dpe']>=231 && $_GET['dpe']<=330)
{
$font = 18;
$width = ImageFontWidth($font) * strlen($_GET['dpe']);
$height = ImageFontHeight($font);
$fichier="images/5.jpg";
$im = ImageCreateFromJpeg ($fichier);
$text_color = imagecolorallocate ($im, 255,255,255);
imagestring ($im, $font, 398, 262, $_GET['dpe'], $text_color);
header("Content-type: image/jpg");
imagejpeg ($im);
imagejpeg ($im, 'resultat.jpg', 100);
imagedestroy($im);
}
else if($_GET['dpe']>=331 && $_GET['dpe']<=450)
{
$font = 18;
$width = ImageFontWidth($font) * strlen($_GET['dpe']);
$height = ImageFontHeight($font);
$fichier="images/6.jpg";
$im = ImageCreateFromJpeg ($fichier);
$text_color = imagecolorallocate ($im, 255,255,255);
imagestring ($im, $font, 398, 306, $_GET['dpe'], $text_color);
header("Content-type: image/jpg");
imagejpeg ($im);
imagejpeg ($im, 'resultat.jpg', 100);
imagedestroy($im);
}
else
{
$font = 18;
$width = ImageFontWidth($font) * strlen($_GET['dpe']);
$height = ImageFontHeight($font);
$fichier="images/7.jpg";
$im = ImageCreateFromJpeg ($fichier);
$text_color = imagecolorallocate ($im, 255,255,255);
imagestring ($im, $font, 398, 355, $_GET['dpe'], $text_color);
header("Content-type: image/jpg");
imagejpeg ($im);
imagejpeg ($im, 'resultat.jpg', 100);
imagedestroy($im);
}
?>

Voila pour les modification apporté j’espère que j'ai bien suivi tes indications et voire ou je me suis planté :s
En te remerciant de ta patience.

Re: probleme sous ie avec mon scripte php

par moogli » 02 févr. 2011, 09:32

pour le formulaire faut modifier

dans teste3.php remplace $_POST['dpe'] par $_GET['dpe']

et bien sur il faut passer en paramètre à l'image donc
<img src="teste3.php<?php if (empty($_POST['dpe'])) echo '?dpe='.$_POST['dpe']; ?>" />

@+

Re: probleme sous ie avec mon scripte php

par baka54 » 02 févr. 2011, 01:49

Re et merci pour ton aide,
J'ai juste un souci depuis que j'ai remplacer mon iframe par <img src="teste3.php" /> j'ai ce code d'erreur:

<br />
<b>Notice</b>: Undefined index: dpe in <b>C:\wamp\www\dpe\teste3.php</b> on line <b>2</b><br />
<br />
<b>Notice</b>: Undefined index: dpe in <b>C:\wamp\www\dpe\teste3.php</b> on line <b>2</b><br />
<br />
<b>Notice</b>: Undefined index: dpe in <b>C:\wamp\www\dpe\teste3.php</b> on line <b>7</b><br />
<br />
<b>Notice</b>: Undefined index: dpe in <b>C:\wamp\www\dpe\teste3.php</b> on line <b>17</b><br />
ÿØÿàJFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

d'après mes renseignement lu sur le net c'est un type d'erreur non critique mais bon j'aimerai savoir comment réglé ce souci :$

En vous remerciant d'avance voici mon nouveau html

<!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>
<link rel="stylesheet" href="/css/template.css" type="text/css" />
</head>
<body>
<div class="php">
<form action="teste3.php" method="post" target="mainFrame">

<input type="text" name="dpe" />

<input type="submit" value="valider" />

</form>

<img src="teste3.php" />
<br />clique <a href='resultat.jpg'>ici</a> pour telecharger l'image.
</div>

</body>
</html>
Merci par avance :$

Re: probleme sous ie avec mon scripte php

par moogli » 02 févr. 2011, 00:51

salut,

les problèmes d'affichage c'est dû a php :) mais au navigateur !

pourquoi utiliser une iframe pour afficher une image ? une simple balise img suffit et régle le problème :)

d'ailleur les frames c'est le mal :)

PS change il " suffi "t de passer en get les info pour l'image :)

@+

probleme sous ie avec mon scripte php

par baka54 » 01 févr. 2011, 16:52

Bonjour,
Je me présente Jérôme généralement je reste que sur du xhtml css et jquery en langages, mais j'ai voulut testé un nouveau projet, étant débutant en php je doit avoué que de l'aide sur la finalisation de mon projet et de réglage pour que cela fonctionne sous ie serai la bienvenue :$, je me permet de vous contacté dû a un problème de codage sous php en effet:
mon script fonction très bien sous firefox, chrome et opera mais sous ie il n’exécute pas mon scripte complément :s
Je m'explique ^^
j'ai mon scripte qui sert a comparer le nombre entrer dans un champs et par rapport au nombre entrer il fixe une bars avec la valeur dessus exemple:
http://www.site.sitinweb.fr/jerome/teste/new/index.php
mon problème c'est que sous ie de 0 a 50 pas de souci fonctionne très bien mais a partir de 51 plus rien ne marche pas d’aperçu rien :s

pour mieux comprendre voici mon scripte php:
<?php
if($_POST['dpe']>=0 && $_POST['dpe']<=50)
{


$font = 18;
$width = ImageFontWidth($font) * strlen($_POST['dpe']);
$height = ImageFontHeight($font);


$fichier="images/1.jpg";
$im = ImageCreateFromJpeg ($fichier);

$text_color = imagecolorallocate ($im, 255,255,255);


imagestring ($im, $font, 398, 76, $_POST['dpe'], $text_color);

header("Content-type: image/jpeg");
imagejpeg ($im);
imagejpeg ($im, 'resultat.jpg', 100);
imagedestroy($im);
}
else if($_POST['dpe']>=51 && $_POST['dpe']<=90)
{

$font = 18;
$width = ImageFontWidth($font) * strlen($_POST['dpe']);
$height = ImageFontHeight($font);


$fichier="images/2.jpg";
$im = ImageCreateFromJpeg ($fichier);

$text_color = imagecolorallocate ($im, 255,255,255);
imagestring ($im, $font, 398, 122, $_POST['dpe'], $text_color);

header("Content-type: image/jpg");
imagejpeg ($im);
imagejpeg ($im, 'resultat.jpg', 100);
imagedestroy($im);
}
else if($_POST['dpe']>=91 && $_POST['dpe']<=150)
{



$font = 18;
$width = ImageFontWidth($font) * strlen($_POST['dpe']);
$height = ImageFontHeight($font);


$fichier="images/3.jpg";
$im = ImageCreateFromJpeg ($fichier);

$text_color = imagecolorallocate ($im, 255,255,255);


imagestring ($im, $font, 398, 172, $_POST['dpe'], $text_color);

header("Content-type: image/jpg");
imagejpeg ($im);
imagejpeg ($im, 'resultat.jpg', 100);
imagedestroy($im);
}
else if($_POST['dpe']>=151 && $_POST['dpe']<=230)
{


$font = 18;
$width = ImageFontWidth($font) * strlen($_POST['dpe']);
$height = ImageFontHeight($font);

$fichier="images/4.jpg";
$im = ImageCreateFromJpeg ($fichier);

$text_color = imagecolorallocate ($im, 255,255,255);

imagestring ($im, $font, 398, 216, $_POST['dpe'], $text_color);
header("Content-type: image/jpg");
imagejpeg ($im);
imagejpeg ($im, 'resultat.jpg', 100);
imagedestroy($im);
}
else if($_POST['dpe']>=231 && $_POST['dpe']<=330)
{



$font = 18;
$width = ImageFontWidth($font) * strlen($_POST['dpe']);
$height = ImageFontHeight($font);


$fichier="images/5.jpg";
$im = ImageCreateFromJpeg ($fichier);

$text_color = imagecolorallocate ($im, 255,255,255);


imagestring ($im, $font, 398, 262, $_POST['dpe'], $text_color);

header("Content-type: image/jpg");
imagejpeg ($im);
imagejpeg ($im, 'resultat.jpg', 100);
imagedestroy($im);
}
else if($_POST['dpe']>=331 && $_POST['dpe']<=450)
{



$font = 18;
$width = ImageFontWidth($font) * strlen($_POST['dpe']);
$height = ImageFontHeight($font);


$fichier="images/6.jpg";
$im = ImageCreateFromJpeg ($fichier);

$text_color = imagecolorallocate ($im, 255,255,255);


imagestring ($im, $font, 398, 306, $_POST['dpe'], $text_color);

header("Content-type: image/jpg");
imagejpeg ($im);
imagejpeg ($im, 'resultat.jpg', 100);
imagedestroy($im);
}
else
{



$font = 18;
$width = ImageFontWidth($font) * strlen($_POST['dpe']);
$height = ImageFontHeight($font);


$fichier="images/7.jpg";
$im = ImageCreateFromJpeg ($fichier);

$text_color = imagecolorallocate ($im, 255,255,255);


imagestring ($im, $font, 398, 355, $_POST['dpe'], $text_color);

header("Content-type: image/jpg");
imagejpeg ($im);
imagejpeg ($im, 'resultat.jpg', 100);
imagedestroy($im);
}
?>

et mon html:
<!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>
<link rel="stylesheet" href="/css/template.css" type="text/css" />
</head>
<body>
<div class="php">
<form action="teste3.php" method="post" target="mainFrame">

<input type="text" name="dpe" />

<input type="submit" value="valider" />

</form>

<iframe name="mainFrame" src="images/1.jpg" width="477" height="437" frameBorder="0">

</iframe>
<br />clique <a href='resultat.jpg'>ici</a> pour telecharger l'image.
</div>

</body>
</html>

j'ai mis l'aperçu dans une iframe c'est sur cela n'est pas top c'est même dépassé mais juste pour testé .
je pense a un problème de succession de création d'image avec la balise "header("Content-type: image/jpg");"
En espérant d'être claire dans ma demande et de savoir m'orienté sur ma faute mon scripte php.

En vous remerciant.