Posted by Jim Carlock on 01/03/06 04:33
Hi Jameson,
<g> I feel like I'm talking to a son... (j.k)
I didn't test the witkey's code. It appears that filetype()
returns "file" or "dir". Try the following.
<?php
// An Example about listing Images.
$dir = ".";
$dh = opendir($dir);
// skip the . and ..
$file = readdir($dh);
$sAltText = 'Picture';
// skip . and ..
if ($file == ".") {
$file = readdir($dh); $file = readdir($dh);
do {
if (mime_content_type($file)=="image/jpeg") {
echo '<img src="' . $dir . $file . '" border="0" alt="' . $sAltText . '" /><br />' . "\n";
} while($file = readdir($dh));
}
}
closedir($dh);
?>
That should work I think. It's air code. I tested it out here
but I'm running into a problem where the mime_content_type
is a problematic function right at the moment.
I read that the glob function is supposed to be a better
alternative in the PHP manual. And if you know that
all the files in the folder are jpg's then you won't have to
do the mime_content_type test.
My apologies about not testing witkey's code. Hope this helps.
If anyone knows how to get the php_mime_magic.dll
file to work on a Windows system, I could use the help.
I uncommented the line in php.ini...
extension=php_mime_magic.dll
and put the php_mime_magic.dll in the system32 folder.
Then I stopped apache and restarted apache...
net stop apache
net start apache
Thanks, much.
Jim Carlock
Post replies to the newsgroup.
Navigation:
[Reply to this message]
|