Broken Gallery plugin after updating server to MYSQL 5.7

At least for the given specific example (the images not showing), the reason it fails is sql-mode “ONLY_FULL_GROUP_BY” in combination with this query.

Error: “contains nonaggregated column ‘AlbumItems.rank’ which is not functionally dependent on columns in GROUP BY clause”

Possible solution: Changing the line 'AlbumItems.rank', to this.

'rank' => 'MAX(AlbumItems.rank)',