Return images from a folder for jQuery Cycle
Posted: Tue Oct 02, 2012 3:55 pm
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
Template with an example of CGSmartImage in use
I cant see any problems with this in future versions either.
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 . '" />';
}
}
Code: Select all
{cgsi_convert max_width='400'}{slideshow}{/cgsi_convert}