How are media files loaded in Gramps web?

I attempted a brute method, of manually uploading media files to the media volume, and scanning through the database for matches in the desc field of the media table, then manually calculating the checksum of the file and setting the path field to the checksum plus the extension, and setting the checksum field to the manually calculated checksum value, then renaming the media file to the checksum plus the extension.

I thought I might succeed in getting media files to align according to the result I got when uploading a new media file.

However this still did not fix media files showing in the interface. And when I open the Media Objects tab in the Gramps interface I’m still seeing descriptions with the absolute path from Windows such as D:/myuser/Documents/tree_media/005206194_04246.jpg.

I don’t have enough of an understanding of how the API works with the database in order to get the database and the API to align…

I also tried using the “Gramps Web Sync” add-on in Gramps Desktop again for good measure, and it is reporting the media files as missing from the server, however at the end of the sync process I get the message along the lines ‘526 errors on upload’. Perhaps it would be helpful to have a little more information on what errors were encountered…

I seem to have succeeded in fixing the media files not showing. I downed the docker compose, I docker removed all volumes, and I upped the docker compose again. There was some error on creating a volume for some reason, so I again downed and removed all volumes, and attempted again to up the docker compose and this time it succeeded.

I then proceeded to input data for the first run, and uploaded the gramps file without media.

Then I proceeded to upload the zipped media from the web interface. Now, media files are finally showing!

Upon inspecting the docker volume for media, I see that it has now created a path similar to my Windows environment:

/var/lib/docker/volumes/grampsweb_gramps_media/_data/D:/myusers/Documents/mytree_media

And all media files are correctly uploaded in this path.

I am however noting that the media file I added directly from the web interface, is not able to be synced back to Gramps Desktop, and is not showing as missing locally. So bi-directional synchronization of media is not currently supported? It seems to have been added to the “data”, because I am seeing the name of the media file on both ends. However it was not showing on either end until I added it again from the web interface. Now it is showing twice in the web interface, but not showing at all in the Gramps Desktop. And media synchronization on Gramps Desktop is giving a 500 error.

UPDATE: actually, I’m seeing the filename existed on my Desktop folder, however it was an empty file. When manually copying it over and overwriting it, it is now showing in Gramps Desktop.

Hi,

sorry, forgot this thread over Christmas.

I think the key insight was that your media files had empty checksums. This does not work with Gramps Web as checksums are crucial to associate media objects to files.

When using an existing Gramps database or XML file with Gramps Web, it is crucial to make some preparatory steps, in particular running the check & repair tool which correctly sets all checksums. See here: Import data - Gramps Web