PHP Photo Gallery 1.1

Uses jQuery and Lightbox 2, free and 'AS IS' by Raffia.ch.

README


<?php

    
// Simple Photo Gallery, PHP >= 5.3, Raffia.ch, V 1.1
    
    
function image_files() {

        
$galfiles array_filter((array) glob("images/*"), function ($file) {
            return (bool) 
preg_match("/^(.*)\.(jpe?g|png|gif)$/i"$file); });

        
natcasesort($galfiles);
        return 
$galfiles;
    }
    
    
// gallery items
    
$gallery "";

    foreach (
image_files() as $file) {

        
$gallery .= <<< EOT
<a data-lightbox="1" target="_blank" href="{$file}" title="{$file}"><img src="{$file}"></a>
EOT;
    }
    
    
// this script's code
    
$code highlight_string(file_get_contents(__FILE__), true);
    
    
// HTML template
    
include "template.html";
    
    
// end

The gallery script is short and simple!