Posted by:
kokilakok
(---.165.163.18.man-static.vsnl.net.in)
Hi
I have a problem please can someone help me.
I need to read the images stored in a folder in the local disk and display it.
there was no problem in reading the names of the images but while displaying the images it showed me nothing.Can anyone please help me.
<html>
<?php
$source_file=array();
$dir="E:\HighMotion";
$handle=opendir($dir);
/*Reading the frames from the folder*/
while (($file = readdir($handle))!==false)
{
$ext=getFileExtension($file);
if (($ext=='jpg') or ($ext=='jpeg'))
{
$source_file[]=$file;
}
}
$size=count($source_file);
for($i=0;$i<$size;$i++)
{
echo "<br> ",$source_file[$i];/*displaying the names of the image*/
echo"<br><img src='$source_file[$i]' width=50 height=50>";/*displaying the image*/
}
closedir($handle);
function getFileExtension($str)
{
$i = strrpos($str,"."
;
if (!$i) { return ""; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
}
?>
</html>