Escaped has become is_file help

Escaped has become is_file help

am 12.09.2007 07:37:46 von Confused but working on it

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:
//Open images directory
$dir = opendir("images");
//List files in images directory
while (($file = readdir($dir)) !== false)
{
echo "";
}
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.
:)

Re: Escaped has become is_file help

am 12.09.2007 14:11:01 von Jerry Stuckle

Confused but working on it wrote:
> 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:
> > //Open images directory
> $dir = opendir("images");
> //List files in images directory
> while (($file = readdir($dir)) !== false)
> {
> echo "";
> }
> 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.
> :)
>
>

You can't replace the readdir() call - that's what fetches the next
directory entry. is_file() is something completely different.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: Escaped has become is_file help

am 12.09.2007 16:47:40 von Confused but working on it

On 2007-09-12 05:11:01 -0700, Jerry Stuckle said:
>> Thanks for any help.
>> :)
>>
>>
>
> You can't replace the readdir() call - that's what fetches the next
> directory entry. is_file() is something completely different.

This is what I finished with last night:"
//Open images directory
$dir = opendir("images");
//List files in images directory
while (($file = readdir($dir)) !== false)
{
while (($file = is_file($dir)) == true)
{
echo "";
}
}
closedir($dir);
?>

Doesn't displa my images but doesnt break eaither. Going to just trying
to match .jpg before gopine to the echo...

Thx for your help