Albums: Manually reorder photos #1948

Open
opened 2026-02-20 01:02:55 -05:00 by deekerman · 7 comments
Owner

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:

image

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.

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: ![image](https://github.com/photoprism/photoprism/assets/6559064/90d4c686-4416-4bf9-a182-550623b3a28e) 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.
Author
Owner

@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/photos endpoint 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 Added sort order that I mentioned above is actually just sorting by files.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, and updated_at fields in the photos_albums table 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.

image

@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/photos` endpoint as search, with ordering controlled by this code: https://github.com/photoprism/photoprism/blob/539e18d984b66b41e5d7b106087068ee5c1c2037/internal/search/photos.go#L170-L199 Note for example that the `Recently Added` sort order that I mentioned above is actually just sorting by `files.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`, and `updated_at` fields in the `photos_albums` table 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. ![image](https://github.com/photoprism/photoprism/assets/6559064/34bccd87-04da-40fc-9ebd-c7683d7657db)
Author
Owner

@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.

@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.
Author
Owner

@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_at or updated_at column from the photos_albums table. 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.

@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_at` or `updated_at` column from the `photos_albums` table. 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.
Author
Owner

@graciousgrey commented on GitHub (Nov 12, 2023):

add an option to sort by "date added to album", which would use the created_at or updated_at column from the photos_albums table.

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.

@graciousgrey commented on GitHub (Nov 12, 2023): > add an option to sort by "date added to album", which would use the created_at or updated_at column from the photos_albums table. 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.
Author
Owner

@raxod502 commented on GitHub (Nov 17, 2023):

We could use the order column in the photos_albums table, 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 the order column.

@raxod502 commented on GitHub (Nov 17, 2023): We could use the `order` column in the `photos_albums` table, 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 the `order` column.
Author
Owner

@graciousgrey commented on GitHub (Dec 5, 2023):

You are right, the order column 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.

@graciousgrey commented on GitHub (Dec 5, 2023): You are right, the `order` column 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.
Author
Owner

@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.

when it comes to albums with hundreds of photos, [...] it would be very tedious to sort them with drag and drop

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.

@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](https://github.com/Radiokot/photoprism-android-client) (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. > when it comes to albums with hundreds of photos, [...] it would be very tedious to sort them with drag and drop 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.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/photoprism#1948
No description provided.