[PHP] Warning: Invalid argument supplied for foreach()
Hi all, I am getting crazy, can't understand what i missed! Does anybody know? $champs = array ("titre_art" => "h3" ,"nom" => "bleu", "prenom" => "green", "resume" => "bold"); foreach($champs as $key => $value) { echo "$row($key))"; } TIA. zeg
[PHP] getimagesize or loop pblm
Hi all, Does anybody can tell me why i have this error :"Fatal error: Maximum execution time of 5 seconds exceeded in photos2.php on line 28" whith this $tab_img = array(); $tab_img_size = array(); for($i=0;$i=56;$i++){ $tab_img[$i] = "images/tof/real_size/techp02_".$i.".jpg"; $tab_img_size = array( /* line 28 */ $i => getimagesize($tab_img[$i])); } Is the getimagesize function too long for making it 56 times?? What do u think ? In fact i want to get all the image size to make a popup link on the thumnail at the real size of the image.Because images don't have the same size and i want to have a clean window whith the popup. I've ever tried this before : $tab_img = array(); $tab_img_size = array(); for($i=0;$i=56;$i++){ $tab_img[$i] = "images/tof/real_size/techp02_".$i.".jpg"; $tab_img_size[$i] = getimagesize($tab_img[$i]); } Hope you understand. TIA. zeg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] getimagesize or loop pblm
So my code is clean ? There isn't a problem of infiny loop? My server is free.fr. How do u suggest i can cach the data? -Message d'origine- De : Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] Envoye : lundi 7 octobre 2002 03:07 A : arnaud gonzales Cc : Php-General Objet : Re: [PHP] getimagesize or loop pblm It could take a while. Depends how fast your server's disk sub-system is. Going to disk to stat and open an image and then parse through the initial headers to get the sizing data can take some time. I'd suggest caching this data somewhere if you are going to need it on every request. -Rasmus On Mon, 7 Oct 2002, arnaud gonzales wrote: > Hi all, > Does anybody can tell me why i have this error :"Fatal error: Maximum > execution time of 5 seconds exceeded in photos2.php on line 28" > whith this > > > $tab_img = array(); > $tab_img_size = array(); > for($i=0;$i=56;$i++){ > $tab_img[$i] = >"images/tof/real_size/techp02_".$i.".jpg"; > $tab_img_size = array( > /*line 28 */ $i => getimagesize($tab_img[$i])); > } > > Is the getimagesize function too long for making it 56 times?? > What do u think ? > In fact i want to get all the image size to make a popup link on the > thumnail at the real size of the image.Because images don't have the same > size and i want to have a clean window whith the popup. > I've ever tried this before : > > $tab_img = array(); > $tab_img_size = array(); > for($i=0;$i=56;$i++){ > $tab_img[$i] = >"images/tof/real_size/techp02_".$i.".jpg"; > $tab_img_size[$i] = getimagesize($tab_img[$i]); > } > Hope you understand. > TIA. > zeg > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php fgets()
Hi, I'm newbie in php and i would like to clearly understand how can i use: LENGTH in string fgets ( int fp [, int length]) "Returns a string of up to length - 1 bytes read from the file pointed to by fp. Reading ends when length - 1 bytes have been read, on a newline (which is included in the return value), or on EOF (whichever comes first). If no length is specified, the length defaults to 1k, or 1024 bytes." -Can i have an example of the differents way for reading file with fgets according to thedifferentes values of "length "? -why '4096' is used as length for reading a file line by line ? $fd = fopen ("/tmp/inputfile.txt", "r"); while (!feof ($fd)) { $buffer = fgets($fd, 4096); echo $buffer; } fclose ($fd); Is this any max for one line?? TIA. arnaud G. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] copy after upload pblm (?path?)
Hi all, I' m trying to copy an uploaded file: if(!empty($fichier)) { $nom = $HTTP_POST_FILES["fichier"]["name"]; $type = $HTTP_POST_FILES["fichier"]["type"]; $taille = $HTTP_POST_FILES["fichier"]["size"]; $nom_tmp = $HTTP_POST_FILES["fichier"]["tmp_name"]; echo "nom : $nom type : $type taille : $taille nom temporaire : $nom_tmp; if(!strpos($nom, .gif") === FALSE || !(strpos($nom, ".jpg") === FALSE)){ --->$res = copy($fichier,$nom); if ($res != 0) { $msg = " File save "; }else{ $msg = " saving Error "; } }else{ $msg = " wrong type "; } ?> and i get the error "Warning: open_basedir restriction in effect. File is in wrong directory in d:\tsunami\zeg\9\exo4upload.php on line 5" so is there any wrong path for $res = copy($fichier,$nom); should i use an absolute path? TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fputs() pblm how write on a new line each time ?
Hi all, I' m searching how to write in a file on a new line each times whith fputs(). Because i want read the file whith file() and so ,have one line per indice in a table. So i need to write on a new line each time. TIA. arnaud. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php