Order images according to file set order

Permalink Browser Info Environment
Just in case someone else faces this issue: To have the images ordered according to the order in the file set, I copied the block controller and added one line to the function 'loadFileSet()':

function loadFileSet(){
    //...
    $fs = FileSet::getByID($this->fsID);
    $fileList = new FileList();
    $fileList->filterBySet($fs);
    $fileList->filterByType(FileType::T_IMAGE);
    $fileList->sortByFileSetDisplayOrder();  // <-- new
    $files = $fileList->get(1000,0);

Type: Discussion
Status: In Progress
View Replies:
msglueck replied on at Permalink Reply
msglueck
thanks! exactly what I was looking for!
stevesmileyrgd replied on at Permalink Reply
Hi

Was this the one located in the libraries directory. I'm using the latest version (5.4.2) and can't seem to find that code anywhere?

Any suggestions?

Thx
10010110 replied on at Permalink Reply
That controller file is located in /packages/asmiller_gallery/blocks/asmiller_gallery and these lines are around 76–80.
kappi replied on at Permalink Reply
You're a life saver, thanks.

Now If I could find a way to call specific images to display when using a query string.
admin replied on at Permalink Reply
Attention: Since there has been no activity on this issue for two weeks, this issue has been automatically archived.

To re-open this issue, reply to this message.
mrjcgoodwin replied on at Permalink Reply
mrjcgoodwin
Thanks for this - just what I needed. Allowed me to create this snippet that might be useful for someone. Creates a custom gallery from a file set, defined by a custom page attribute called 'gallery_fileset'.

$gallerySet = $c->getAttribute('gallery_fileset');
Loader::model("file_set");
Loader::model('file_list');
$fs = FileSet::getByID($gallerySet);
$fl = new FileList();
$fl->filterBySet($fs);
$fl->sortByFileSetDisplayOrder();
$files = $fl->get();
foreach($files as $f) {
    echo '<img src="'.$f->getDownloadURL().'" alt="'.$f->getTitle().'">';
}

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.