Page 1 of 1

Return images from a folder for jQuery Cycle

Posted: Tue Oct 02, 2012 3:55 pm
by cb2004
I thought to lighten the load of a site and not install another module I would write a quick UDT to return all the jpegs from a folder and spit them out to so I could use jQuery Cycle on them.

UDT called slideshow

Code: Select all

$files = glob('uploads/images/front-slideshow/*.*');

foreach($files as $file) {
	if(!preg_match('/thumb_/',$file) && preg_match('/.jpg/i',$file)) {
		echo '<img src="' . $file . '" />';
	}
}
Template with an example of CGSmartImage in use

Code: Select all

{cgsi_convert max_width='400'}{slideshow}{/cgsi_convert}
I cant see any problems with this in future versions either.