Afficher un icon

Signaler
Messages postés
47
Date d'inscription
samedi 10 avril 2004
Statut
Membre
Dernière intervention
17 février 2009
-
Messages postés
47
Date d'inscription
samedi 10 avril 2004
Statut
Membre
Dernière intervention
17 février 2009
-
bonjour ,
j'ai un script php qui affiche des .jpg , des .png , des .gifs
je voudrai qu il affiche des .ico
mais ça ne marche pas, j'ai une croix à la place de l'iconne .Pourquoi et comment faire pour résoudre se petit problème .j ai le même problème avec le .bmp
merci

5 réponses

Messages postés
681
Date d'inscription
samedi 26 février 2005
Statut
Membre
Dernière intervention
21 août 2014
8
....bien difficile de t'aider si on sais pas avec quoi tu travaile, ni a quoi ton scrpt ressemble, et sans savoir dans "quoi" et comment tu veux afficher tes images....

<hr size="2" width="100%" />Developpement Web Yannic GraphiX | Mon CMS yArt et sa démo
<hr size="2" width="10" />
Messages postés
47
Date d'inscription
samedi 10 avril 2004
Statut
Membre
Dernière intervention
17 février 2009

bonjour ok voila le code des deux pages 

 <?php



   require_once("../../class2.php");




   if (!check_class($pref['mes_iconnes_view_class'])) {
      // No access for current user
      header("location:".e_BASE."index.php");
   }



   if (eregi("request", e_QUERY)) {
      $tmp     = explode(".", e_QUERY);
      $filename = substr(e_QUERY, strrpos(e_QUERY, "/")+1);
  /*  $filename2 = substr(e_QUERY, strrpos(e_QUERY, "/")+1); */
      $bufsize = 2048;
      ignore_user_abort(true);
      $data_len = filesize($filename);
  /* $data_len = filesize($filename2); */
      if ($seek > ($data_len - 1)) {
         $seek = 0;
      }
      $res =& fopen($filename, 'rb');
  /* $res =& fopen($filename2, 'rb');  */
      if ($seek) {
         fseek($res , $seek);
      }
      $data_len -= $seek;
      header("Expires: 0");
      header("Cache-Control: max-age=30" );
      header("Content-Type: application/force-download");
      header("Content-Disposition: attachment; filename="{$filename}"");
  /* header("Content-Disposition: attachment; filename2="{$filename2}"");  */
      header("Content-Length: {$data_len}");
      header("Pragma: public");
      if ($seek) {
         header("Accept-Ranges: bytes");
         header("HTTP/1.0 206 Partial Content");
         header("status: 206 Partial Content");
         header("Content-Range: bytes {$seek}-".($data_len - 1)."/{$data_len}");
      }
      while (!connection_aborted() && $data_len > 0) {
         echo fread($res , $bufsize);
         $data_len -= $bufsize;
      }
      fclose($res);
   }

   require_once(e_PLUGIN."mes_iconnes/mes_iconnes_variables.php");
   define("PAGE_NAME", $pref['mes_iconnes_title']);
   require_once(e_HANDLER."comment_class.php");
   require_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_comment.php");




   $mes_iconnestable  = "mes_iconnes";
   $categorytable = "mes_iconnes_category";






   $aj   = new textparse;
   $sql2 = new db;
   $con  = new convert;
   $cobj = new comment;



   $clipsPerPage = $pref['mes_iconnes_clips_per_page'];



   if(!is_object($gen)){
      $gen = new convert;
   }



   require_once(HEADERF);



   $text = "\";

   // No query so display category list
   if (!e_QUERY) {
      $sql->db_Select($categorytable, \"*\", \"cat_parent_category=0 and find_in_set(cat_visibility,'\".$e107Helper->getUserClassList().\"') order by cat_display_order asc\");
      $text .= \"----
".MES_ICONNES_LAN_01.", \";

      while (list($catid, $catname, $catdescription, $caticon, $catdisplay_order, $cat_parent, $cat_visibility) = $sql->db_Fetch()) {
         $qry = \"select * from \".MPREFIX.\"$mes_iconnestable as e
                  left join \".MPREFIX.\"$categorytable as c on e.category = c.cat_id
                  where (e.category=$catid
                     or (e.category=c.cat_id and c.cat_parent_category=$catid))
                     and e.approved='0'
                     and find_in_set(c.cat_visibility,'\".$e107Helper->getUserClassList().\"')
                     \";
         $count = $sql2->db_Select_gen($qry);
         $numsubcats = $sql2->db_Count($categorytable.\" where cat_parent_category='$catid'and find_in_set(cat_visibility,'\".$e107Helper->getUserClassList().\"')\");
         $text .= \"----
";
         if ($count) {
            $text .= "http://,50,200
";
      $fieldmand[] = "*";
   }
/* ajout du champ image en plus dans l admin ajout d un fichier image distant ou image local ou video local ou distante */
  
   if (strpos($pageid, "local") > 0) {
      if ($pageid == "media_local") {
         $fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_03_0;
         $fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_03_1;
         $fieldvalu[] = mes_iconnesGetFiles(e_FILE, $pref["mes_iconnes_media_dir"]);
      } else {
         $fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_11_0;
         $fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_11_1;
         $fieldvalu[] = mes_iconnesGetFiles(e_FILE, $pref["mes_iconnes_image_dir"]);;
      }
      $fieldname[] = "filename2";
      $fieldtype[] = "dropdown2";
      $fieldmand[] = "*";
   } else {
      if ($pageid == "media_remote") {
         $fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_10_0;
         $fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_10_1;
      } else {
         $fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_12_0;
         $fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_12_1;
      }
      $fieldname[] = "filename2";
      $fieldtype[] = "text";
      $fieldvalu[] = "
http://,50,200
";
      $fieldmand[] = "*";
   }
  
   /* fin */



   $fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_00_0;
   $fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_00_1;
   $fieldname[] = "title";
   $fieldtype[] = "text";
   $fieldvalu[] = ",50,100";
   $fieldmand[] = "*";



   $fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_02_0;
   $fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_02_1;
   $fieldname[] = "category";
   $fieldtype[] = "dropdown2";
   $fieldvalu[] = $categories;
   $fieldmand[] = "*";



   $fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_08_0;
   $fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_08_1;
   $fieldname[] = "datestamp";
   $fieldtype[] = "datestamp";
   $fieldvalu[] = "2000";
   $fieldmand[] = "";



   $fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_01_0;
   $fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_01_1;
   $fieldname[] = "description";
   $fieldtype[] = "textarea";
   $fieldvalu[] = ",90%,100px";
   $fieldmand[] = "";



   $fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_04_0;
   $fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_04_1;
   $fieldname[] = "icon";
   $fieldtype[] = "image";
   $fieldvalu[] = e_IMAGE.$pref["mes_iconnes_icon_dir"]."/";
   $fieldmand[] = "";



   if ($pageid "media_local" || $pageid "media_remote") {
      $fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_05_0;
      $fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_05_1;
      $fieldname[] = "width";
      $fieldtype[] = "text";
      $fieldvalu[] = $pref["mes_iconnes_default_width"].",4,4";
      $fieldmand[] = "";



      $fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_06_0;
      $fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_06_1;
      $fieldname[] = "height";
      $fieldtype[] = "text";
      $fieldvalu[] = $pref["mes_iconnes_default_height"].",4,4";
      $fieldmand[] = "";
   } else {
      $fieldcapt[] = "";
      $fieldnote[] = "";
      $fieldname[] = "width";
      $fieldtype[] = "hidden";
      $fieldvalu[] = "0";
      $fieldmand[] = "";



      $fieldcapt[] = "";
      $fieldnote[] = "";
      $fieldname[] = "height";
      $fieldtype[] = "hidden";
      $fieldvalu[] = "0";
      $fieldmand[] = "";
   }



   $fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_09_0;
   $fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_09_1;
   $fieldname[] = "author";
   $fieldtype[] = "text";
   $fieldvalu[] = USERNAME.",50,100";
   $fieldmand[] = "";



   $fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_07_0;
   $fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_07_1;
   $fieldname[] = "comment";
   $fieldtype[] = "checkbox";
   $fieldvalu[] = "1";
   $fieldmand[] = "";



   $fieldcapt[] = MES_ICONNES_LAN_ADMIN_MEDIA_15_0;
   $fieldnote[] = MES_ICONNES_LAN_ADMIN_MEDIA_15_1;
   $fieldname[] = "approved";
   $fieldtype[] = "checkbox";
   $fieldvalu[] = "0";
   $fieldmand[] = "";



//---------------------------------------------------------------
//              END OF CONFIGURATION AREA
//---------------------------------------------------------------



   // -------- Presets. ------------  // always load before auth.php
   if ($show_preset) {
      require_once(e_HANDLER."preset_class.php");
      $pst = new e_preset;
      $pst->form = "adminform"; // form id of the form that will have it's values saved.
      $pst->page = e_SELF; // display preset options on which page(s).
      $pst->id = "admin_".$mes_iconnestable;
   }



   if ($categories=="") {
      $ns->tablerender($configtitle, MES_ICONNES_LAN_ADMIN_MEDIA_13);
      require_once(e_ADMIN."footer.php");
      return;
   }



   require_once(e_ADMIN."auth.php");
   require_once("form_handler.php");
   $rs = new form;



   // Page config checks
   $toapprove = isset($_POST['toapprove']) && !isset($_POST['showall']) ? true : false;
   // Validation checks



if (isset($_POST['add']) || isset($_POST['update'])) {
      if (strlen($_POST['filename']) == 0) {
         $message .= "File name ".MES_ICONNES_LAN_ADMIN_MEDIA_12;
      }
      if (strlen($_POST['title']) == 0) {
         $message .= "Title ".MES_ICONNES_LAN_ADMIN_MEDIA_12;
      }
   }



if (isset($_POST['add']) || isset($_POST['update'])) {
      if (strlen($_POST['filename2']) == 0) {
         $message .= "File name2 ".MES_ICONNES_LAN_ADMIN_MEDIA_12;
      }
      if (strlen($_POST['title']) == 0) {
         $message .= "Title ".MES_ICONNES_LAN_ADMIN_MEDIA_12;
      }
   }



   // Data is valid so try and add
   if (!isset($message) && isset($_POST['add'])) {
      if ($debug) print "
".print_r($_POST)."
";
      $count = count($fieldname);
      for ($i=0; $i<$count; $i++) {
         if ($fieldname[$i] == "datestamp" && $pref["mes_iconnes_use_exif"] == "1") {
            if (function_exists(exif_read_data)) {
               $exif = exif_read_data($rs->getfieldvalue($fieldname[0], $fieldtype[0], $debug), 0, true);
               if ($exif && isset($exif['EXIF']['DateTimeOriginal'])) {
                  $tmp = $exif['EXIF']['DateTimeOriginal'];
                  $inputstr .= " '".mktime(substr($tmp,11,2), substr($tmp,14,2), substr($tmp,17,2), substr($tmp,5,2), substr($tmp,8,2), substr($tmp,0,4))."', ";
               } else {
                  $inputstr .= " '".$rs->getfieldvalue($fieldname[$i], $fieldtype[$i], $debug)."', ";
               }
            } else {
               $inputstr .= " '".$rs->getfieldvalue($fieldname[$i], $fieldtype[$i], $debug)."', ";
            }
         } else {
            $inputstr .= " '".$rs->getfieldvalue($fieldname[$i], $fieldtype[$i], $debug)."', ";
         }
      }
      $inputstr .= time(); // timestamp
      $inputstr .= ", 0";    // lastview
      $inputstr .= ", 0";    // viewcount



      if ($sql->db_Insert($mes_iconnestable, "0, $inputstr", $debug)) {
         $message = MES_ICONNES_LAN_ADMIN_MEDIA_06;
         unset($_POST['add']);
      } else {
         $message = MES_ICONNES_LAN_ADMIN_MEDIA_07;
         //print mysql_error()." ".$inputstr;
      }
   }



   // Data is valid so try and update
   if (!isset($message) && isset($_POST['update'])) {
      if ($debug) print "
".print_r($_POST)."
";
      $count = count($fieldname);
      for ($i=0; $i<$count; $i++) {
         if ($fieldname[$i] == "datestamp" && $pref["mes_iconnes_use_exif"] == "1") {
            if (function_exists(exif_read_data)) {
               $exif = exif_read_data($rs->getfieldvalue($fieldname[0], $fieldtype[0], $debug), 0, true);
               if ($exif && isset($exif['EXIF']['DateTimeOriginal'])) {
                  $tmp = $exif['EXIF']['DateTimeOriginal'];
                  $inputstr .= $fieldname[$i]."='".mktime(substr($tmp,11,2), substr($tmp,14,2), substr($tmp,17,2), substr($tmp,5,2), substr($tmp,8,2), substr($tmp,0,4))."', ";
               } else {
                  $inputstr .= $fieldname[$i]."='".$rs->getfieldvalue($fieldname[$i], $fieldtype[$i], $debug)."', ";
               }
            } else {
               $inputstr .= $fieldname[$i]."='".$rs->getfieldvalue($fieldname[$i], $fieldtype[$i], $debug)."', ";
            }
         } else {
            $inputstr .= $fieldname[$i]."='".$rs->getfieldvalue($fieldname[$i], $fieldtype[$i], $debug)."', ";
         }
      }
      $inputstr .= "timestamp=".time();
      if ($sql->db_Update($mes_iconnestable, "$inputstr WHERE $primaryid='".$_POST[$primaryid]."'", $debug)) {
         $message = MES_ICONNES_LAN_ADMIN_MEDIA_04;
         unset($_POST['update']);
      } else {
         if ($debug) print "
".mysql_error()."
";
         $message = MES_ICONNES_LAN_ADMIN_MEDIA_05;
      }
   }



   // Get details from DB if Edit, otherwise set from POST data
   if (isset($_POST['edit'])) {
      $sql -> db_Select($mes_iconnestable, "*", " $primaryid='".$_POST['existing']."' ");
      $row = $sql->db_Fetch();
   } else {
      if (isset($_POST['add']) || isset($_POST['update'])) {
         $row = $_POST;
      }
   }



   // Try the delete
   if (isset($_POST['delete'])) {
      if ($debug) print "
".print_r($_POST)."
";
      $message = ($sql -> db_Delete($mes_iconnestable, "$primaryid='".$_POST['existing']."' ")) ? MES_ICONNES_LAN_ADMIN_MEDIA_08 : MES_ICONNES_LAN_ADMIN_MEDIA_09;
   }



   // Draw the form
   if (file_exists(e_PLUGIN."updatechecker/updatechecker.php")) {
      require_once(e_PLUGIN."updatechecker/updatechecker.php");
      $text .= updateChecker(MES_ICONNES_LAN_NAME, MES_ICONNES_LAN_VER, "
http://www.bugrain.plus.com/e107plugins/mes_iconnes.ver
", "|");
   }



   $text .= "
<form method='post' action='".e_SELF."' id='myexistingform'>
      \";

   if (isset($message)) {
      $text .= \"----
$message, \";
      if ($debug) print \"
\".mysql_error().\"
\";
   }

   $text .= \"----
";

   if ($toapprove) {
      $ep_existing_sql = "approved<>'0' and $ep_existing_sql";
   }
   $table_total = $sql->db_Select($mes_iconnestable, "id, filename, filename2, title, category, approved", $ep_existing_sql, true, $debug);
   if (!$table_total) {
      $text .= MES_ICONNES_LAN_ADMIN_MEDIA_10;
      if ($toapprove) {
         $text .= "
";
      }
   } else {
      $text .= "".MES_ICONNES_LAN_ADMIN_MEDIA_00.":&nbsp;<select name='existing' id='existing' class='tbox'>";
      while (list($id, $filename, $filename2, $title, $category, $approved) = $sql-> db_Fetch()) {
         $sql2->db_Select($categorytable, "*", "cat_id=$category");
         list($catid, $catname, $rest) = $sql2->db_Fetch();
         $approved = ($approved==0 && $approved!="") ? "" : "* ";
         $text .= "<option value='$id'>$approved$title ($catname)</option>";
      }
      $text .= "</select>
&nbsp;
      &nbsp;";
     /* if ($toapprove) {
         $text .= "";
         $text .= "";
      } else {
         $text .= "";
      }*/
      $text .= "&nbsp;";
      $text .= ", \";
   }

   $text .= "
</form>
";



   $text .= "
\n";
   $text .= "<form method='post' action='".e_SELF."' id='adminform'>\";
   for ($i=0; $i<count($fieldcapt); $i++) {
      $form_send = $fieldcapt[$i] . \"|\" .$fieldtype[$i].\"|\".$fieldvalu[$i];
      if ($fieldtype[$i] != \"hidden\") {
         $text .=\"----

            ".$fieldcapt[$i]." ".$fieldmand[$i]."
".$fieldnote[$i].",
            ";
      }
      $text .= $rs->user_extended_element_edit($form_send, $row[$fieldname[$i]], $fieldname[$i]);
      if ($fieldtype[$i] != "hidden") {
         $text .=", \";
      }
   };

   $text .= \"----
";

   if (isset($_POST['edit']) || isset($_POST['update'])){
      $text .= "
      ";
   } else {
      $text .= "";
   }

   if ($toapprove) {
      $text .= "";
   }
   $text .= "
</form>
";
   $ns->tablerender($configtitle, $text);



   require_once(e_ADMIN."footer.php");
?>
Messages postés
681
Date d'inscription
samedi 26 février 2005
Statut
Membre
Dernière intervention
21 août 2014
8
t'a toujours pas répondu à ma question....

<hr size="2" width="100%" />Developpement Web Yannic GraphiX | Mon CMS yArt et sa démo
<hr size="2" width="10" />
Messages postés
47
Date d'inscription
samedi 10 avril 2004
Statut
Membre
Dernière intervention
17 février 2009

je travaille en local avec easy php je voudrai ajouter un deusieme champ images comme le premier filename j ai ajouté un deusieme filename2 champ mais j'ai des probleme . le nom de ma deusieme image est bien envoyé dans ma base de donée mais l'image elle n est pas envoyé dans le dossier .
Messages postés
47
Date d'inscription
samedi 10 avril 2004
Statut
Membre
Dernière intervention
17 février 2009

j ai un lien qui permet de télécharger le fichier qui est presenté .j ai la fenetre de téléchargement qui se presente .
mais le poids fais toujours 17,2  . il porte bien le nom du fichier .le telechargement ce fais ,mais le fichier n'est pas valide .

if (check_class($pref['mes_iconnes_download_class'])) {
         $text2 .= "<tr><td class='forumheader3' >&nbsp;".MES_ICONNES_LAN_53."kkkk&nbsp;".MES_ICONNES_LAN_53."</td></tr>";
      }