Getting images from a file set

Permalink
Hi,

can somebody give me some hints how I can get the images from a file set and output them?

I started to make a block but I don't know how to get
- the existing file sets (the user should be able to select the file set)
- the images from that selected file set.

See 'clearing' branch at github:
https://github.com/core77/foundation_sites...

Any help would be appreciated.

Thanks
Chris

View Replies:
hutman replied on at Permalink Reply
hutman
Using this should give you a list of File Sets that the user has access to

FileSet::getMySets();


If you need all file sets regardless of who the user is you should be able to do this

$u = User::getByUserID(1);
$fileSets = FileSet::getMySets($u);


To get a list of files in that set you just need to do something like this

Loader::model('file_list');
$fl = new FileList();
$fl->filterBySet(FileSet $fs);
$files = $fl->get($itemsToGet = 100, $offset = 0);


That's all from the Files Documentation, I'm not sure how much of that will have changed for 5.7
mesuva replied on at Permalink Reply
mesuva
I updated the List Files From Set block for 5.7, it's the master branch here:
https://github.com/Mesuva/list_files_from_set...

Then to output the images, it's just a case of creating a custom block template to output img tags for the files instead of links. It should be pretty much the same as 5.6, you could refer tohttp://www.concrete5.org/marketplace/addons/image-list-templates/... to show what needs to happen.
core77 replied on at Permalink Reply
Hi guys,

thank you very much!

Yesterday I discovered your package on github, mesuva. Very nice!!
Since I want to learn developing blocks I'll try it myself. Your package/block is a nice study object.