PHP Classes

SPL Find Images: Get images for a gallery using SPL find iterators

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-06-15 (9 months ago) RSS 2.0 feedNot enough user ratingsTotal: 109 All time: 9,664 This week: 71Up
Version License PHP version Categories
spl-find-images 1.0GNU General Publi...5PHP 5, Files and Folders
Description 

Author

This package can get images for a gallery using SPL find iterators.

It can search for image files with a given extension in a given search directory.

The class returns an array with the list for found images including the path of the full size images and thumbnails.

Picture of Ravi Kumar
  Performance   Level  
Innovation award
Innovation award
Nominee: 2x

 

Example

<?php
   
include_once 'Gallery.php';

   
$gallery = new Gallery();
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>CSS3 Gallery & Lightbox</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="assets/css/demo.css">
    <link rel="stylesheet" href="assets/css/style.css">
</head>
<body>
   
    <div class="container">
        <header>
            <h1>CSS3 <span>Gallery & Lightbox</span></h1>
            <h2>A simple CSS-only Gallery & lightbox</h2>
        </header>

        <section>
            <ul class="lb-album">

            <?php
               
foreach($gallery->getImages() as $index => $image) {
                   
$id = "image-$index";
                   
$href = "#$id";
                   
$full = $image['full'];
                   
$thumb = $image['thumb'];

           
?>

                <li>
                    <a href="<?php echo $href;?>">
                        <img src="<?php echo $thumb;?>" alt="<?php echo $id;?>">
                       
                    </a>
                    <div class="lb-overlay" id="<?php echo $id;?>">
                        <img src="<?php echo $full;?>" alt="<?php echo $id;?>" />
                       
                        <a href="#page" class="lb-close">x Close</a>
                    </div>
                </li>
           
            <?php
               
}
           
?>

            </ul>
        </section>
    </div>
</body>
</html>


  Files folder image Files (37)  
File Role Description
Files folder imageassets (2 directories)
Files folder imageclasses (1 directory)
Files folder imageuploads (2 directories)
Plain text file Gallery.php Class Gallery class file
Accessible without login Plain text file index.php Example Demo file

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 94%
Total:109
This week:0
All time:9,664
This week:71Up