Getting images from a file set
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:
Any help would be appreciated.
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
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.
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.