mirror of
https://github.com/photoprism/photoprism.git
synced 2026-03-02 22:57:18 -05:00
Albums: Manually reorder photos #1948
Labels
No labels
ai
android
api
auth
awesome
bug
bug
ci
cli
config
database
declined
deprecated
docker
docs 📚
documents
duplicate
easy
enhancement
enhancement
enhancement
epic
faces
feedback wanted
frontend
hacktoberfest
help wanted
idea
in-progress
incomplete
index
invalid
ios
labels
live
live
low-priority
macos
member-feature
metadata
mobile
nas
needs-analysis
no-coding-required
no-coding-required
observability
performance
places
please-test
plus-feature
priority
pro-feature
question
raspberry-pi
raw
released
released
released
research
resolved
security
sharing
tested
tests
third-party-issue
thumbnails
upgrade
upstream-issue
ux
vector
video
waiting
won't fix
won't fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/photoprism#1948
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @raxod502 on GitHub (Nov 4, 2023).
Describe what problem this solves and why this would be valuable to many users
I would like to set the order of the photos within an album to exactly what I specify. In other words, I know exactly what order I want the photos to be in, and I'd like to use that order, rather than having them automatically sorted based on date or filename.
This is a common feature that users might expect when migrating from other services like Google Photos or Apple Photos, which allow photos within an album to be re-ordered using drag-and-drop. For example, when importing albums from Google Photos, the photos may show up in a different order in PhotoPrism, which may be unexpected.
Describe the solution you'd like
In an ideal world, it would be possible to choose between an album being automatically sorted or manually sorted. In the latter case, it would ideally be possible to reorder the photos using some kind of drag-and-drop interface.
Describe alternatives you've considered
I'm open to any manner of workarounds that would let me finish importing my library from Google Photos into PhotoPrism. For example, I noticed that one of the sort options is "recently added". It's not clear to me whether that means recently added to the album or recently added to the library. If the former, it might be possible for me to manually edit the dates for each photo in the database so that the album shows up in the order that I want. Or I could write a script that makes a copy of an album with a different order by adding the photos one at a time in the new order.
If nobody has any ideas offhand then I'll take some time to look through the code and see if I can understand how albums are stored in the database, to see whether what I outlined in the previous paragraph is workable. If I come up with anything I'll post an update here with instructions.
Additional context
Discussion with @graciousgrey on Gitter:
I also did some searches of open and closed issues and the project roadmap, but didn't find any existing discussion around manual photo reordering within albums, except for a brief mention in the original album implementation (https://github.com/photoprism/photoprism/issues/15) that drag-and-drop reordering might be a desirable future goal.
@raxod502 commented on GitHub (Nov 6, 2023):
It seems that this is categorically not possible in the current implementation of PhotoPrism. From what I can tell, viewing an album uses the same
/api/v1/photosendpoint as search, with ordering controlled by this code:github.com/photoprism/photoprism@539e18d984/internal/search/photos.go (L170-L199)Note for example that the
Recently Addedsort order that I mentioned above is actually just sorting byfiles.media_id, and in particular that none of the sort options make any reference to the membership of photos in an album.There are
order,created_at, andupdated_atfields in thephotos_albumstable which one might think could control sort order, but as far as I can tell, all of them do nothing to affect the order in which photos are displayed in an album, regardless of settings.@graciousgrey commented on GitHub (Nov 8, 2023):
The sorting options that are currently available within albums (newest first, oldest first, filename ...) are the same as for the normal search, with the difference that only the photos of the album are displayed. Therefore, new logic will be required to set a manual sort order for photos in albums.
@raxod502 commented on GitHub (Nov 11, 2023):
That's what I gathered from reading the code. Perhaps a simple solution to start: add an option to sort by "date added to album", which would use the
created_atorupdated_atcolumn from thephotos_albumstable. This wouldn't be the most user-friendly, since it wouldn't allow for re-ordering photos using drag-and-drop in an existing album, but it would at least make it possible to set the order of photos when initially creating an album.I will see if I can put together a pull request to show what that would look like as proof of concept.
@graciousgrey commented on GitHub (Nov 12, 2023):
This would require users to add all photos to albums individually. However, if you select several photos at once and then create an album from them, this sorting option would probably not help. I don't think it hurts to add such a sorting option in addition to the ones we have already, but it's not really a solution to the actual feature request.
@raxod502 commented on GitHub (Nov 17, 2023):
We could use the
ordercolumn in thephotos_albumstable, and instead of setting every row to 0 like present, populate it with auto-increment by default, and when adding a batch of photos to an album, add them in the order that they appear in the search. That would probably match what most people would expect. It would also add the future possibility of allowing an existing album to be re-ordered by updating theordercolumn.@graciousgrey commented on GitHub (Dec 5, 2023):
You are right, the
ordercolumn has been added with the intention to use it to manually define a sort order. The tricky part here is the UX. Drag and drop should work fine on desktop, but it gets trickier on mobile devices.Do you know how other applications solve this? Is it only possible on desktop or is it also possible on mobile devices to set a sort order with drag and drop?
I guess on phones it doesn't make much sense, especially when it comes to albums with hundreds of photos, as it would be very tedious to sort them with drag and drop.
@raxod502 commented on GitHub (Dec 9, 2023):
It's pretty common to support this on mobile. Usually the way it's done is that you can long-press a photo to drag it to a different position rather than selecting it to view individually. Another typical approach is having an "edit" toggle in the album view that enables drag-and-drop for the photos rather than viewing them when tapped. Sometimes these are combined, where you enter "edit mode" for the album, and then tap photos to select them (for bulk operations, or deletion), or long-tap to reorder them.
This is of course easier in a native app implementation like the unofficial Android app for PhotoPrism (which doesn't support this at present, but could if there were API level support for manual album ordering), but it's still possible in a web view. Here's a screen recording of how Google Photos handles the interface in a mobile web view (it looks kind of trash, because Google Photos doesn't have a mobile optimized web interface, because they try to get you to install the app instead, but it still works - although you can see me struggle to get the long-press gesture to register properly at the beginning):
https://nextcloud.intuitiveexplanations.com/s/CKQXNCBcZAaby7X
Nextcloud seems to do a poor job of scaling videos to fit the browser window, at least in my Firefox, so you may need to scroll to the bottom of the page and enter fullscreen mode to see the above recording properly.
Oh, and for completeness, that screen recording is from Android 14 (GrapheneOS), with Google Photos running inside Firefox. Thanks to PhotoPrism I no longer have the Google Photos app installed on my phone, nor do new photos end up in Google Photos! I just haven't deleted the old library yet.
Yeah, I think it is understood that the main sorting mechanism is that photos are sorted by timestamp when you create the album initially, or they are sorted in the order that you add them (which isn't the case at present - if you upload a set of photos at once into the same album, they seem to end up in a random order). Drag-and-drop or manual sorting would only be useful for small albums, or for making minor corrections to an album where most photos are in the right order, but a few ended up in the wrong way.