Zdolny
Joined: 14 Oct 2008 Posts: 5
|
Posted: Thu Nov 05, 2009 3:06 pm Post subject: Icon Filename Extension |
|
|
Small extension which give access to images located in dirs in weathermap/images.
You can create dir weathermap/images/routers and there put image
| Code: |
*** editor.inc.php_old 2009-04-19 14:25:00.000000000 +0200
--- editor.inc.php 2009-11-05 19:33:27.000000000 +0100
***************
*** 297,319 ****
if (is_dir($imagedir))
{
- $n=0;
$dh=opendir($imagedir);
-
if ($dh)
{
while ($file=readdir($dh))
{
$realfile=$imagedir . DIRECTORY_SEPARATOR . $file;
$uri = $imagedir . "/" . $file;
!
! if(is_file($realfile) && ( preg_match('/\.(gif|jpg|png)$/i',$file) ))
{
$imagelist[] = $uri;
- $n++;
}
- }
closedir ($dh);
}
}
--- 297,329 ----
if (is_dir($imagedir))
{
$dh=opendir($imagedir);
if ($dh)
{
while ($file=readdir($dh))
{
$realfile=$imagedir . DIRECTORY_SEPARATOR . $file;
$uri = $imagedir . "/" . $file;
! if(is_file($realfile) && ( preg_match('/\.(gif|jpg|png|bmp)$/i',$file) ))
{
$imagelist[] = $uri;
}
+ if (is_dir($realfile) && !( preg_match('/\./i',$realfile) ))
+ {
+ $dh1=opendir($realfile);
+ while ($file=readdir($dh1))
+ {
+ $realfile2=$realfile . DIRECTORY_SEPARATOR . $file;
+ $uri2 = $realfile . "/" . $file;
+ if(is_file($realfile2) && ( preg_match('/\.(gif|jpg|png)$/i',$file) ))
+ {
+ $imagelist[] = $uri2;
+ }
+ }
+ closedir ($dh1);
+ }
+ }
closedir ($dh);
}
}
|
Full function:
| Code: |
function get_imagelist($imagedir)
{
$imagelist = array();
if (is_dir($imagedir))
{
$dh=opendir($imagedir);
if ($dh)
{
while ($file=readdir($dh))
{
$realfile=$imagedir . DIRECTORY_SEPARATOR . $file;
$uri = $imagedir . "/" . $file;
if(is_file($realfile) && ( preg_match('/\.(gif|jpg|png|bmp)$/i',$file) ))
{
$imagelist[] = $uri;
}
if (is_dir($realfile) && !( preg_match('/\./i',$realfile) ))
{
$dh1=opendir($realfile);
while ($file=readdir($dh1))
{
$realfile2=$realfile . DIRECTORY_SEPARATOR . $file;
$uri2 = $realfile . "/" . $file;
if(is_file($realfile2) && ( preg_match('/\.(gif|jpg|png|bmp)$/i',$file) ))
{
$imagelist[] = $uri2;
}
}
closedir ($dh1);
}
}
closedir ($dh);
}
}
return ($imagelist);
}
|
| Description: |
|
| Filesize: |
82.32 KB |
| Viewed: |
652 Time(s) |

|
|
|