|
Posted by Dragan Stanojevic - Nevidljivi on 12/19/05 13:15
matt VanDeWalle wrote:
> hello again
> I am trying to figure out how i can read the list of files in a
> directory using the opendir() and readdir() functions. Normally this
> goes fine but within the loop, what i am wanting to do is echo the
> filename if it is a jpg file, but if its a .gif, just continue.
> I have several files i wish to seperate based on the basename of the file.
> i read the basename help file and know how to use it even to exclude the
> .3letterextention. I am however wanting to skip if it happens to be a
> .gif, is there some sort of way to i guess, do the basename function in
> reverse, e.g if it comes across "xxxxxx.gif" it would skip it but not
> skip over the xxx.jpg files?
> that is my latest problem, it skips everything when i have a line like
> this in my loop
>
> if($file = basename('.gif',$file))
> continue;
> else go on with code
>
> this not only skips over .gif files, but everything is ignored
> any ideas?
U have only one = in if! It always returns true upon execution...
try this:
// $file is filename like pic.gif
$ext = pathinfo( $file );
$ext = $ext[ 'extension' ];
if( $ext === 'gif' )
continue;
bye,
N::
Navigation:
[Reply to this message]
|