Undefined offset

achovovich Messages postés 17 Date d'inscription mercredi 7 août 2002 Statut Membre Dernière intervention 4 janvier 2006 - 16 nov. 2004 à 14:22
achovovich Messages postés 17 Date d'inscription mercredi 7 août 2002 Statut Membre Dernière intervention 4 janvier 2006 - 17 nov. 2004 à 08:45
bonjour,
j'utilise un source pri sur ce site, mais apparement, ca marche pas top pour la creation d'image
c'est un source de creation de galerie
un fichier index appel le fichier photo en passant en parametre le repertoire a generer

le probleme c'est ke je ne comprend pas le message d'erreur
merci d'avance

Acho.

Notice: Undefined offset: 21 in d:\site\community\friends\gallerie\photo.php on line 51

==============================
source
==============================
//recup du scan
$listing_dossier=scandir($dossier);
$taille_array=count($listing_dossier);

//creation repertoire thumbnail si besoin
$dir_name=$dossier." thumbnail";
if(!is_dir($dir_name))
{
mkdir($dir_name);

//boucle creation thumbnail
for($i=2;$i<$taille_array;$i++)
{
//recup du dossier d'image
$localisation_image[$i]=$dossier."/".ereg_replace(" ","%20",$listing_dossier[$i]);
//creation du nouveau nom
$new_image_name=$dir_name."/thumbnail_".$listing_dossier[$i];
//creation d'une image php assopciée à l'image jpeg parent du site
$new_image=imagecreatefromjpeg($localisation_image[$i]);
//creation du canvas du thumbnail
$new_thumb=imagecreatetruecolor(imagesx($new_image)/20,imagesy($new_image)/20);

//copie de l'image dans le thumbnail
imagecopyresized($new_thumb,$new_image,0,0,0,0,imagesx($new_image)/20,imagesy($new_image)/20,imagesx($new_image),imagesy($new_image));

//finalisation de la creation du thmbnail
imagejpeg($new_thumb, $new_image_name, 50);
}
}?>
<table width="100%" border="0">
<? //boucle affichage
for($i=2;$i<$taille_array;$i=$i+3)
{
?>
<tr>
<td>
[<? print($dossier. " target="_blank">" border="0">]

<? print($listing_dossier[$i]);?>
</td>
<td><? if($listing_dossier[$i+1]! =""){?>
[<? print($dossier. " target= "_blank">" border="0">]

<? print($listing_dossier[$i+1]);?> <? }?>
</td> ligne 51 ci dessous
<td><? if($listing_dossier[$i+1]!=""){?>
[<? print($dossier. " target="_blank">" border="0">]

<? print($listing_dossier[$i+2]);?><? }?>
</td>
</tr>
<? }?>

3 réponses

achovovich Messages postés 17 Date d'inscription mercredi 7 août 2002 Statut Membre Dernière intervention 4 janvier 2006
16 nov. 2004 à 16:15
En fait, l'erreur viendrai du fait ke apache ne connai ces fonctions.
Comment faire pour les declarer?

imagecreatetruecolor
imagecreatefromjpeg

Merci
0
cs_Anthomicro Messages postés 9433 Date d'inscription mardi 9 octobre 2001 Statut Membre Dernière intervention 13 avril 2007 8
16 nov. 2004 à 23:25
Salut :-)

Undefined offset ça veut dire que tu essaies d'accéder à une valeur d'un tableau qui n'existe pas, donc par exemple si tu essaies d'accéder à $i[150] et que le tableau $i s'arrête à 140 tu auras une erreur...

a +

http://www.vulgarisation-informatique.com : entraide, dépannage et vulgarisation informatique
0
achovovich Messages postés 17 Date d'inscription mercredi 7 août 2002 Statut Membre Dernière intervention 4 janvier 2006
17 nov. 2004 à 08:45
ok, merci pour cette definition

-=Sauve un arbre ...=--Mange un Castor-
0
Rejoignez-nous