<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"> <url> <loc>http://example.com/sample.html</loc> <image:image> <image:loc>http://example.com/image.jpg</image:loc> </image:image> <image:image> <image:loc>http://example.com/photo.jpg</image:loc> </image:image> </url> </urlset>
<?php $images = array();$path = '/absolute/path/to/images/folder/';$handle = opendir($path);while ($entry = readdir($handle)) { if (($entry != '.') && ($entry != '..')) { if (!is_dir($path.$entry)) { $ext = strtolower(substr(strrchr($entry, '.'), 1)); if (in_array($ext, array('jpg', 'jpeg', 'png', 'gif'))) { $images[] = $entry; } } }}closedir($handle);//now display the XML sitemapheader('Expires: Mon, 26 Jul 1997 05:00:00 GMT');header('Last-Modified: '.gmdate('D, d M Y H:i:s').'GMT');header('Cache-Control: no-cache, must-revalidate');header('Pragma: no-cache');header('Content-type:text/xml; charset=utf-8');echo '<?xml version="1.0" encoding="UTF-8"?>';echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">';echo '<url>';echo '<loc>http://www.example.com/isitemap.php</loc>';if ($images) { foreach ($images as $image) { echo '<image:image><image:loc>http://www.example.com/relative/path/to/images/folder/'.$image.'</image:loc></image:image>'; }}echo '</url>'; echo '</urlset>';?>
<?php $images = array();$path = '/absolute/path/to/images/folder/';$handle = opendir($path);while ($entry = readdir($handle)) { if (($entry != '.') && ($entry != '..')) { if (!is_dir($path.$entry)) { $ext = strtolower(substr(strrchr($entry, '.'), 1)); if (in_array($ext, array('jpg', 'jpeg', 'png', 'gif'))) { $images[] = $entry; } } }}closedir($handle);?>
$images = eFactory::getFiles()->listFiles('relative/path/to/images/folder/', '(.jpg)|(.jpeg)|(.png)|(.gif)$');
$images = eFactory::getFiles()->listFiles('relative/path/to/images/folder/', '(.jpg)|(.jpeg)|(.png)|(.gif)$', true);
$images = eFactory::getFiles()->listFiles('relative/path/to/images/folder/', '(.jpg)|(.jpeg)|(.png)|(.gif)$', true, true);
global $mainframe, $fmanager;$abs_path = $mainframe->getCfg('absolute_path').'/relative/path/to/images/folder/';$images = $fmanager->listFiles($abs_path, '(.jpg)|(.jpeg)|(.png)|(.gif)$');
$images = array(); $images['files'] = array(); $images['title'] = ''; $images['link'] = ''; $dir = $mainframe->getCfg('absolute_path').'/'.$gallery_element.'/'; if (file_exists($dir) && is_dir($dir)) { if ($handler = opendir($dir)) { $pat = "#((\.jpg)|(\.jpeg)|(\.png)|(\.gif))$#i"; $n = 0; while (($f = readdir($handler)) !== false) { if (preg_match($pat, $f)) { if ($n >= $maximages) { break; } $n++; $images['files'][] = array( 'filename' => $f, 'url' => self::secureLive().'/'.$gallery_element.'/'.$f, 'title' => self::titlefromfile($f) ); } } } closedir($handler); } return $images; }