File: classes/Find/README.md

Recommend this page to a friend!
  Classes of Ravi Kumar  >  SPL Find Images  >  classes/Find/README.md  >  Download  
File: classes/Find/README.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: SPL Find Images
Get images for a gallery using SPL find iterators
Author: By
Last change:
Date: 6 years ago
Size: 842 bytes
 

 

Contents

Class file image Download

SPL Find

This package provides specialized Iterator classes for finding files and directories.

	include_once 'Find.php';

	$path 		=	realpath( 'YOUR_PATH' );

	$find = new Find;
	$files = $find->in( $path );

	foreach( $files as $key => $file) {
		echo '<pre> ' , $key . ' <br> ' , print_r($file, 1), '</pre>';
	}

Methods

It uses template and fluent design pattern.

  1. extension
  2. sort
  3. limit

extension

This is used to filter the files on the basis of extensions of the file.

	$files = $find->extension(['jpg'])->in( $path );	

sort

This is used to sort the files. <br> const SORT_BY_NAME = 1 <br> const SORT_BY_NAT_NAME = 2

	$files = $find->sort( 2 )->in( $path );	

limit

This is used to limit the output files.

	$files = $find->limit( $offset, $limit )->in( $path );	

For more information send a message to info at phpclasses dot org.