Example #1
0
function getImages()
{
    /** settings **/
    $images_dir = '../images/';
    $thumbs_dir = '../thumbs/';
    $thumbs_width = 200;
    $images_per_row = 3;
    $array = Sort_Directory_Files_By_Last_Modified($images_dir);
    $info = $array[0];
    /** generate photo gallery **/
    $image_files = get_files($images_dir);
    if (count($image_files)) {
        foreach ($image_files as $index => $file) {
            $thumbnail_image = $thumbs_dir . $file;
            if (!file_exists($thumbnail_image)) {
                $extension = get_file_extension($thumbnail_image);
                if ($extension) {
                    make_thumb($images_dir . $file, $thumbnail_image, $thumbs_width);
                }
            }
        }
    }
    $result = count($info);
    foreach ($info as $key => $detail) {
        $withoutExt = preg_replace('/\\.[^.\\s]{3,4}$/', '', $detail['file']);
        $out = strlen($withoutExt) > 20 ? substr($withoutExt, 0, 20) . "..." : $withoutExt;
        echo '<a href="gestimage.php?image=../images/', $detail['file'], '" name="imageClick" type="submit" class="photo-link smoothbox"><img src="', $thumbs_dir, $detail['file'], '" />
                    <div>
                        <small><b style="font-size:18px ">', $out, '</b></small><br>
                        <small><b style="font-size:18px "> - - - - - - - - - - - - - - - - </b></small><br>
                        <small>', 'PropriƩtaire: ', getOwner($detail['file']), '</small><br>
                        <small>', 'Date: ', $detail['date'], '</small><br>
                        <small>', 'Commentaire: ', getNbCommentaire($detail['file']), '</small>
                     </div>
                   </a>';
        if ($result % 3 == 0) {
            if ($key % $images_per_row == 0) {
                echo '<div class="clear"></div>';
            }
        } elseif ($result % 3 == 1) {
            if ($key % $images_per_row == 1) {
                echo '<div class="clear"></div>';
            }
        } elseif ($result % 3 == 2) {
            if ($key % $images_per_row == 2) {
                echo '<div class="clear"></div>';
            }
        }
    }
    echo '<div class="clear"></div>';
}
Example #2
0
    }
}
 
usort($array, create_function('$a, $b', 'return strcmp($a["timestamp"], $b["timestamp"]);'));
 
if($sort_type == 'descending')
{
krsort($array);
}
 
return array($array, $sort_type);
}

$dir  = '/tmp/logs1/';
 
$array = Sort_Directory_Files_By_Last_Modified($dir);
 
// Info Array
$files1 = $array[0];
 
// Sort Type
$sort_type = $array[1];


echo "<table border='1'><tr><td>SeqNo</td><td>FileName</td></tr>";
$count = 0;
foreach($files1 as $key=>$file)
{
	 if (!in_array($file,array(".","..")))
	 {
		$count++;