Partage
  • Partager sur Facebook
  • Partager sur Twitter

Probleme affichage image

    9 mars 2007 à 13:48:20

    Bonjour j ai creer une page qui permet de faire sa page perso mais le probleme les images veulent pas s afficher , sous FF avec firebug il trouve bien l image mais elle s affiche pas j ai essayer de redimensionner l image mais c pareil :/

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Document sans nom</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    <link href="../style.css" rel="stylesheet" type="text/css">
    </head>

    <body>
    <? include("connexion.php");?>


    <?
    /* *********script d'uplaod des fichiers**********/
    // Taille max des fichiers (octets)
    $MFS=30000;
    // Répertoire de stockage
    $rep="../site/images_cat/";
    $image=array("ban_perso","photo1","photo2");
    $nom_images=array();
    $message_return="";
    for($nbr=0;$nbr<10;$nbr++){
            if(isset($_FILES[$image["$nbr"]])) {
            if($_FILES[$image["$nbr"]]['size']>0) {
            $savefile= $rep.$_FILES[$image["$nbr"]]['name'];
            $nom_images["$nbr"]= $rep.$_FILES[$image["$nbr"]]['name'];
            $temp = $_FILES[$image["$nbr"]]['tmp_name'];
           
             if (move_uploaded_file($temp, $savefile)) { ?>
            <? $message_return="NOUVEAU SITE ENREGISTRE !";?>
            <?   } else { ?>
             <? $message_return="ERREUR D'ENREGISTREMENT";?>
             <? }

            } else { ?>
            <? /* printf("fichier trop gros");*/?>
            <? }
            }
    }
    printf("".$message_return);

    for($nbr=0;$nbr<10;$nbr++){
            $nom_images["$nbr"]=strrchr($nom_images["$nbr"],"/");
            $nom_images["$nbr"]=trim($nom_images["$nbr"],"/");
    }

    /* ********fin script upload des fichiers***********/
    ?>



    <?
    {

                    $requete = mysql_query("INSERT INTO metier (id , nom , prenom , adresse , codepostal , tel , fax , port , ban_perso , photo1 , photo2 , rub, dep, nom_dep)
                    VALUES(NULL, '"
    .AddSlashes ($nom)."','".AddSlashes ($prenom)."','".AddSlashes ($adresse)."','$codepostal','$tel ','$fax ','$port ','".$nom_images[0]."','".$nom_images[1]."','".$nom_images[2]."' ,  '".AddSlashes ($rub)."',  '".AddSlashes ($dep)."', '".AddSlashes ($nom_dep)."')");

                    if ($requete)

                    {

                            echo '<p align="center">LE SITE A ETE ENREGISTRE AVEC SUCCES !</P>';}

                    else

                    {

                            echo '<p align="center">PROBLEME DE MISE A JOUR DE LA BASE. RECOMMENCEZ LA PROCEDURE</P>';

                    }

            }

            mysql_close();
            ?>
    </body>
    </html>

    ca c est la page d insert dans mysql

    <?php include('bandeau.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=iso-8859-1" />
    <meta http-equiv="Page-Enter" content="revealTrans(Duration=1.0,Transition=12)">
    <meta http-equiv="Page-Exit" content="revealTrans(Duration=1.0,Transition=23)">
    <title>Site 1 page</title>
    </head>
    <body>
    <div align="center">
    <br/><br/>
    <form action="template/ajout_site1.php" method="post" enctype="multipart/form-data" name="form1">
    <table width="800" border="0" align="center" cellspacing="5">
      <tr align="center">
        <td colspan="3" class="titre"><p>Enregistrer un site sur le Portail Qualité France.</p>      </td>
      </tr>
      <tr align="center">
        <td colspan="3"><blockquote>
              <p><span class="Style2">Les noms de fichiers photo ne doivent pas contenir
                de caractères accentués (é,è,ê,ù,à)
                ni de &quot;\&quot; ou &quot;/&quot; ni d'esp<font size="2">aces.</font></span></p>
              </blockquote></td>
      </tr>
      <tr bgcolor="#CCCCCC">
        <td width="166" height="2">Dans quelle rubrique </td>
        <td colspan="2"><p>
              <select name="rub" id="rub">
                <option>3eme age</option>
                            <option>Actualités et médias</option>
                            <option>Administration</option>
                            <option>Arts et culture</option>
                            <option>Beauté</option>
                            <option>Bébés, enfants</option>
                            <option>Commerces et économie</option>
                            <option>Hotels</option>
                            <option>Internet</option>
                            <option>Mode</option>
                            <option>Produits régionaux</option>
                            <option>Restaurant</option>
                            <option>Santé</option>
                            <option>Spectacles</option>
                            <option>Services</option>
                            <option>Sports et loisirs</option>
              </select>
            </p>
            </td>
      </tr>
      <tr bgcolor="#99CCFF">
        <td width="166" height="3">Num Département ( ex: 06 ) </td>
        <td colspan="2"><input name="dep" type="text" id="dep" size="5" maxlength="2"></td>
      </tr>
      <tr bgcolor="#CCCCCC">
        <td height="3" bgcolor="#CCCCCC">Nom Département </td>
        <td colspan="2" bgcolor="#CCCCCC"><input name="nom_dep" type="text" id="recommand" size="85"></td>
      </tr>
      </table>
      <table width="705" height="494" border="1">
      <tr>
        <td width="139" height="90"><p>&nbsp;</p>
        <p>&nbsp;</p></td>
        <td width="411">
            <input name="ban_perso" type="file" id="ban_perso"></td>
            <td width="133"><p>&nbsp;</p>
        <p>&nbsp;</p></td>
       
      </tr>
      <tr>
        <td height="70" >
            <p align="center">
               <input name="nom" type="text" id="nom">
            </p>
        <p align="center">
             <input name="prenom" type="text" id="prenom">
       </p>
        <p align="center">
                 <input name="adresse" type="text" id="adresse">
       </p>
       <p align="center">
                 <input name="codepostal" type="text" id="codepostal">
       </p><br>
      <input name="tel" type="text" id="tel">
        <input name="fax" type="text" id="fax">
       <input name="port" type="text" id="port">
            </td>
        <td height="700" width="411" rowspan="3" colspan="2">
            <textarea name="presentation" rows="40" cols="100"></textarea>
            </td>
      </tr>
      <tr>
        <td height="158">
            <input name="photo1" type="file" id="photo1">
            </td>
      </tr>
      <tr>
      <td height="158">
      <input name="photo2" type="file" id="photo2">
            </td>
      </tr>
    </table>
          <p>
            <input type="submit" name="Submit" value="Envoyer">
          </p></td>
      </tr>
    </table>
    </form>
    </div>
    </body>
    </html>


    la le formulaire

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>..:: Accueil - Portail  Quatilé France ::..</title>
    <META http-equiv="Content-Type" Content="text/html; charset=ISO-8859-15">
    <link href="../style.css" rel="stylesheet" type="text/css">

    <SCRIPT language="JavaScript">
    <!--
    function openWin(URL,Name,Width,Height,Scroll) { window.open(URL,Name,'width='+Width+',height='+Height+',scrollbars='+Scroll+',status=no,resizable=no,titlebar=no'); }
    //-->
    </SCRIPT>
    </head>

    <body>
    <div align="center">
    <?
    include ("connexion.php");

    $query = "SELECT * FROM metier WHERE id = '".$id."' ";
                    $result = mysql_query($query);

            if($result)

            {

                    while($r = mysql_fetch_object($result))

                    {
            $nom = StripSlashes($r->nom);
            $prenom = StripSlashes($r->prenom);
            $email = StripSlashes($r->email);
            $adresse = StripSlashes($r->adresse);
            $metier = StripSlashes($r->metier);
            $ville = StripSlashes($r->ville);
            $spe = StripSlashes($r->spe);
            $application = StripSlashes($r->application);
            $accueil = StripSlashes($r->accueil);
            $recommand = StripSlashes($r->recommand);
            $dep = StripSlashes($r->dep);
           

     ?>
    <table width="705" height="494" border="0">
      <tr>
        <td width="139" height="90"><p>&nbsp;</p>
        <p>&nbsp;</p></td>
        <td width="411">
             <?
            if ($r->ban_perso)
                    echo '<img src="images_cat/'.$r->ban_perso.'"  />';
            else
                    echo 'Pas de photo disponible' ;
            ?>
            </td>
            <td width="133">&nbsp; </td>
       
      </tr>
      <tr>
        <td height="70" >
            <p align="justify">
               <? print $nom ?>
            </p>
        <p align="justify">
             <? print $prenom ?>
       </p>
        <p align="justify">
         <? print $adresse."&nbsp;" ; print $r->codepostal."&nbsp;"; print $ville."&nbsp;" ?>
       </p><br>
        <?
               if ($r->tel)
                      echo 'Tel : '.$r->tel.'&nbsp;|&nbsp;';
            ?>
        <?
                    if ($r->fax)
                            echo 'Fax : '.$r->fax.'&nbsp;|&nbsp;';
            ?>
        <?
                    if ($r->port)
                            echo 'Port : '.$r->port;
            ?>
            </td>
        <td height="700" width="411" rowspan="3" colspan="2"><? print $presentation ?></td>
      </tr>
      <tr>
        <td height="158">
            <?
                    if ($r->photo1)
                            echo '<img src="images_cat/'.$r->photo1.'" height="158" >';
                    else
                           echo 'Pas de photo disponible' ;
            ?>
            </td>
      </tr>
      <tr>
      <td height="158">
      <?
            if ($r->photo2)
                    echo '<img src="images_cat/'.$r->photo2.'" height="158" >';
            else
                    echo 'Pas de photo disponible' ;
            ?>
            </td>
      </tr>
    </table>
      <?

                    }

            }else{

                            echo"erreur de requête";

    }

    mysql_close();

    ?>
    </div>
    </body>
    </html>


    et ca la page d affichage

    ma table mysql comporte 14 champs
    id nom prenom adresse codepostal tel fax port ban_perso photo1 photo2 rub dep nom_dep


    • Partager sur Facebook
    • Partager sur Twitter
      9 mars 2007 à 13:54:39

      montre nous le code source de la page générée...
      • Partager sur Facebook
      • Partager sur Twitter
        9 mars 2007 à 13:58:32

        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
        <html>
        <head>
        <title>..</title>
        <META http-equiv="Content-Type" Content="text/html; charset=ISO-8859-15">
        <link href="../style.css" rel="stylesheet" type="text/css">

        <SCRIPT language="JavaScript">
        <!--
        function openWin(URL,Name,Width,Height,Scroll) { window.open(URL,Name,'width='+Width+',height='+Height+',scrollbars='+Scroll+',status=no,resizable=no,titlebar=no'); }
        //-->
        </SCRIPT>
        </head>

        <body>
        <div align="center">
        <table width="705" height="494" border="0">
          <tr>

            <td width="139" height="90"><p>&nbsp;</p>
            <p>&nbsp;</p></td>
            <td width="411">
                 <img src="images_cat/banniere-bis-essai.jpg"  />       </td>
                <td width="133">&nbsp; </td>
           
          </tr>
          <tr>
            <td height="70" >

                <p align="justify">
                   test </p>
            <p align="justify">
                    </p>
            <p align="justify">
             &nbsp;&nbsp;&nbsp;   </p><br>
                        </td>
            <td height="700" width="411" rowspan="3" colspan="2"></td>

          </tr>
          <tr>
            <td height="158">
                <img src="images_cat/banniere-bis-essai12.jpg" height="158" >   </td>
          </tr>
          <tr>
          <td height="158">
          <img src="images_cat/bleach-manga02-big.gif" height="158" >   </td>

          </tr>
        </table>
          </div>
        </body>
        </html>


        On voit bien que l image est charger mais etrangement on l a voit pas , j ai ete voir sur le ftp et l image est bien ds le dossier

        voila merci :)
        • Partager sur Facebook
        • Partager sur Twitter
          9 mars 2007 à 14:02:15

          essaye de faire ceci: en imaginant que ton script s'appel mon_script.php, et qu'il est situé à l'adresse suivante:
          http://example.com/folder/mon_script.php... essaye de tapper cette url: http://example.com/folder/images_cat/banniere-bis-essai12.jpg et dis moi si l'image s'affiche (tu prendras soins de remplacer les faux domaines et l'arborescence par la tienne ;) )
          • Partager sur Facebook
          • Partager sur Twitter
            9 mars 2007 à 14:08:16

            J'ai une question à part, si un les nom d'un champ de table mysql est un nombre, comment y accéder avec mysql_fetch_object() ? Car $obj->0123456 est invalide.
            • Partager sur Facebook
            • Partager sur Twitter

            Probleme affichage image

            × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
            × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
            • Editeur
            • Markdown