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, biapar, Willr, Ingo, swaiba, simon_w

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


Reply

3 Posts   695 Views

Avatar
DesignerX.com.au

17 August 2011 at 3:42am Community Member, 107 Posts

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

Avatar
swaiba

17 August 2011 at 10:33pm Forum Moderator, 1796 Posts

this will help get you started - http://php.net/manual/en/function.glob.php

Avatar
martimiz

17 August 2011 at 11:13pm (Last edited: 17 August 2011 11:14pm), Forum Moderator, 1091 Posts

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