Get files from a set

Permalink 2 users found helpful
Hi, I want to write some functionality to get a list of images from a set, output them into a div and then write my own javascript slideshow.

Can somebody please help me with the code to iterate through each image in a particular set? I intend to just code this in my theme php page rather than using a block. Is that workable?

Thanks

View Replies:
Xscratch replied on at Permalink Reply
Xscratch
Hey, I need this too ;-)
ringo replied on at Permalink Reply
Anyone able to suggest a way to do this?

Thanks
Xscratch replied on at Permalink Reply
Xscratch
Hi, yesterday maybe I found a way to the solution:
I simply looked in the controller.php of the concrete's slideshow block; take a look at the loadFileSet() function.
ringo replied on at Permalink Reply
hi, would you have a code sample of how you did this? i had no joy when trying to do this.

I simply want to return img tags with all of the images in a given set.

Thanks
WebSolutions replied on at Permalink Reply
WebSolutions
I could use this info too
andrew replied on at Permalink Reply
andrew
try something like this:

Loader::model("file_set");
Loader::model('file_list');
$fs = FileSet::getByName('Your File Set');
$fl = new FileList();
$fl->filterBySet($fs);
$files = $fl->get();
foreach($files as $f) {
    print $f->getFileName();
    print $f->getTitle(); 
    print $f->getAttribute("width");
    print $f->getDownloadURL();
    print $f->getRelativePath();
}

etc....
WebSolutions replied on at Permalink Reply
WebSolutions
That's awesome.

Where would I get a list of getAttribute attributes?

Is there a list of what other attributes about the files that I can get? ie. is there a getThumbnail for example.
andrew replied on at Permalink Reply
andrew
Anything found in Dashboard > Files > Attributes. We typically install width and height by default but you can add any kind of attribute there. Just use the "handle" of the attribute in the $file->getAttribute($handle) method and you should be able to retrieve it.

You can also setup files to automatically save certain attributes upon upload/rescan with some information found here:

http://www.concrete5.org/documentation/developers/files/metadata...
WebSolutions replied on at Permalink Reply
WebSolutions
aah... makes sense.

Thanks for the help Andrew - really helped a lot. It's pointed me in the right direction for finding more attributes from \concrete\models\file_version.php

I thought I might post the list that I found in there that relates to displaying a list of files:

getFileID()
getFileVersionID()
getPrefix()
getFileName()
getTitle()
getTags()
getDescription()
isApproved()
getAttribute()
getAttributeList()
getGenericTypeText()
getSize()
getFullSize()
getAuthorName()
getAuthorUserID()
getFile()
getTagsList()
getMimeType()
getDateAdded()
getType()
getTypeObject()
getVersionLogComments()
getExtension()
getPath()
getURL()
getDownloadURL()
getRelativePath()
getThumbnailPath()
getThumbnailSRC()
hasThumbnail()
getThumbnail()
getAttributeValueObject()
mikefatty replied on at Permalink Reply
mikefatty
Hi every one

Is it possible in any way to retrieve the FileSetName and have this printed or echoed out along with, for instance getPath?

//Mike