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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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   1022 Views

Avatar
DesignerX.com.au

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

Avatar
swaiba

Forum Moderator, 1899 Posts

17 August 2011 at 10:33pm

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

Avatar
martimiz

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