0

Trovebox (OpenPhoto) – How to change default album ordering?

Trovebox (formerly OpenPhoto) is a great self-hosted alternative to Flickr. Unfortunately its UI is a bit lacking, and the designers have made some rather stubborn and questionable usability decisions that make Trovebox a little less perfect than it could be.

In my case, I have a collection of photos that I wanted to share, but have the receiving user view the photos in the order they were taken without having to rely on them manually choosing both “sort by date uploaded” and “sort in ascending order.” That’s an additional layer of tech support abstraction I’d rather not have to deal with.

And frankly, when I upload a collection of photos of an event, I’m hard-pressed to think of any circumstance in which I’d ever want to view them in reverse order anyway.

  • I don’t want to see a wedding that starts with the bride and groom leaving for their honeymoon.
  • I don’t want to see a vacation album that starts with me coming back home.
  • I don’t want to see a “life and times of” album that starts with the subject in hospice.

This very quick and dirty solution will make your albums all display in ascending order (“earliest pictures first”) and sorted by date uploaded (this could be replaced with date taken, but I’ve found camera EXIF information to be too messy for this to ever work properly– no fault of Trovebox).

This will also “break” your Gallery function in that the Gallery will no longer show the most recent photos first, but if you’re like me and only showing items on an album-by-album basis then you most likely don’t care about “Photostream” or “Gallery” functionality either.

Access your web host through your preferred method of connectivity.

In your main directory, go to:

src/libraries/controllers/PhotoController.php

Around line 146 you’ll see a line that looks like this:

$additionalParams = array('returnSizes' => $returnSizes, 'sortBy' => 'dateUploaded,desc');

(Optional) Copy and paste this line directly above itself, then comment it out.

//$additionalParams = array('returnSizes' => $returnSizes, 'sortBy' => 'dateUploaded,desc');
$additionalParams = array('returnSizes' => $returnSizes, 'sortBy' => 'dateUploaded,desc')

In the second line, change ‘dateUploaded,desc’ to ‘dateUploaded,asc’ and save!

$additionalParams = array('returnSizes' => $returnSizes, 'sortBy' => 'dateUploaded,asc');

Mind the closing parenthesis and semicolon, as if you accidentally delete those minor characters you can end up (temporarily) breaking your entire site.

Your changes are live and your albums should sort in ascending order!

In the event something is broken, you can undo the changes by deleting your second line and uncommenting the first.

There is probably a more elegant way to do this but I haven’t spent much time figuring out the guts of Trovebox and don’t really intend to. Life is short enough and my patience for open-source projects that present themselves as “an alternative to ___!” yet require a full workweek to get working in any competent state has worn thin. Flickr can be set up in 5 minutes and does everything one needs it to. Any aspiring alternative should do at least that much.

Leave a Reply