|
Posted by Kimmo Laine on 01/25/07 07:44
"Tobi Hammert" <speichern@gmail.com> wrote in message
news:1169688138.621201.85300@a75g2000cwd.googlegroups.com...
>i just want to show up a random pic.
>
> <?
> $files = glob("./gfx/zufall/*");
> shuffle ($files);
> if (count($files) < 1)
> $count = count($files);
> else
> $count = 1;
> for ($i = 0; $i < $count; $i ++)
> {
> $file = $files[$i];
> echo "<a href='index.php'><img src='$file' height='341'
> width='634' border='0'></a>";
> }
> ?>
>
> it works fine, just ocasionally, it shows NO pic.
> whats wrong? that is, how can i solve it?
On those rare occasions when it doesn't work, have you looked at the source
code to see what the output was? print_r($files); to see if . and .. are
included in the file list. If they are, those might be casusing your
problem. If not, see the output when it doesn't work and try to figure what
went wrong. Another guess would be non-ascii characters in filenames don't
translate to url, like characters with umlauts or stuff like that.
--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti pδivittyvδ nettisarjis
spam@outolempi.net | rot13(xvzzb@bhgbyrzcv.arg)
Navigation:
[Reply to this message]
|