You are here: Escaped has become is_file help « PHP Programming Language « IT news, forums, messages
Escaped has become is_file help

Posted by Confused but working on it on 09/12/07 05:37

Thanks for the help with escaping that line. My gallery works great.
Just lines up the pictures and if you resize they move with it instead
of using tables. Added a class to pad each image and looks pretty
clean. The code:
<?php
//Open images directory
$dir = opendir("images");
//List files in images directory
while (($file = readdir($dir)) !== false)
{
echo "<img src='images/$file' class=\"pad1em\">";
}
closedir($dir);
?>

Actually going to replace images with thumbs and make the thumbs link
out to an image. But not until I get rid of the . and .. image holders.

I've been reading the manual and have been trying to replace the
readdir with is_file with mixed results, none good.
while (($file = is_file($dir)) !== false)
Replacing readdir with is_file straight just gave me the page with no
images or image markers.
while (($file = is_file($dir)) !== true)
Then I left as is and changed the false to true and the page took
about 20 seconds and then I stopped it and ended up with thousands of ?
image markers or place holders or whatever they are called.
while (($file = is_file($dir)) == true)
This gave me my full pages but no images or markers.

At this point I think it's clear I'm lost. And tired.
Seems to me that if $file is a dir then it tries again in the while statement.
Then it should hit the .. directory and try again.
Now it should hit a real file and do what is inside of the {}.
Rinse and repeat. Somehow made an infinite loop.
So the original readdir keeps going until it tests as false. Maybe i
need a while inside of a while but maybe an easier way.

Thanks for any help.
:)
<snooze>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация