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
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
Hey, I need this too ;-)
Anyone able to suggest a way to do this?
Thanks
Thanks
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.
I simply looked in the controller.php of the concrete's slideshow block; take a look at the loadFileSet() function.
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
I simply want to return img tags with all of the images in a given set.
Thanks
I could use this info too
try something like this:
etc....
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....
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.
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.
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...
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...
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()
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()
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
Is it possible in any way to retrieve the FileSetName and have this printed or echoed out along with, for instance getPath?
//Mike