Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

I need a Small script to scan a folder!! PLEASE HELP ME

Go to End

3 Posts   953 Views


Community Member, 107 Posts

17 August 2011 at 3:42am

hh..Hi everyone..

I am looking for the following:

A small script to scan a folder for images then give the results as a list, EG:

scan the following folder :
"assets/images "
.. then load the results into a $variable so $variable will result in:
<img alt="" src="/assets/images/image-1.png">
<img alt="" src="/assets/images/image-2.png">
<img alt="" src="/assets/images/image-3.png">
.... & so on
also, has anyone yet create a "working" galley & slider module or widgets.. I wish i had more time, i would be creating one...

Thank you Great SS :D


Forum Moderator, 1899 Posts

17 August 2011 at 10:33pm

this will help get you started -


Forum Moderator, 1391 Posts

17 August 2011 at 11:13pm

Edited: 17/08/2011 11:14pm

Maybe do a query on your Files table. something like:

DataObject::get('File', "ClassName = 'Image' and Filename like '/assets/images/%'");

That will get you the images in the /assets/image/ directory and all its subdirs. It'll work for images that live the Files & images section of the CMS