How to add media files in a particular folder using the GrampsWeb interface

I’m back on using Gramps and this time I’m trying to use it 100% from the web interface Gramps Web.
So at this time I have all setup and running on a raspberry pi 4 with 8gb ram and the DB and media files stored on the NAS I mounted with NFS. I’m accesing Gramps from a windows laptop and using Chrome as my browser.
I’m testing the new interface before committing all the changes I have to and I’m facing with a difficulty someone might help me to solve.

When using Gramps in desktop mode, I can save my media I use as source in ordered folders (first by type (birth, death, census…) and then by location/country (Italy, USA, Argentina…)). When switching to the web interface, I can add new media and I can visualize it and edit it again with the web interface but when I look into how the media was stored, it uses a random name (I assume it to be a hash) like f0702cc0836af1aef17a22e33541e174.png and the file is put in the root of my media folder.

So the question are:

  • How can I set where in the media folder the document show go?
  • How can I preserve or at least put a more meaningful name to the file?

Thanks

Jorge

Hi Jorge,

the reason it was implemented this way is that the way Gramps (desktop) handles media files is not really suited for use on a server. It has security implications that are difficult to deal with. For instance, you cannot simply present a “file chooser” to the user and browse the server’s file system, see e.g. this comment.

Personally, I don’t mind because I’m trying to force myself to use Gramps (plus Gramps Web) as the single tool for all my research, and I realized the main reason I was using the file explorer to browser my media files (organized in folders) was because I was not properly organizing them in Gramps itself (with tags, linked to different objects, etc.). I also think we should develop the Gramps Web media browser into a more powerful tool with virtual folders based on dates, tags, etc…

That being said, I do understand the wish to organize your media files in folders and with more meaningful names. To do that, the most convenient way is to use Gramps desktop, using any of the existing addons for media organization or just manually moving or renaming the files.

This will work much better when you are not using local media files on your server, but on object storage like S3. In that case, files are stored by checksum and moving/renaming a file does not require any moving or reuploading of the file to the server. So you can arbitrarily reorganize your files locally and they will continue working on Gramps Web.

Hello David,

so reading your reply I must assume that Gramps Web cannot be used as standalone. What I mean is that I was hoping to be able to do all the actions through the web browser and without having to open Gramps Desktop. Currently I’m having some constraints that do not allow me to have Gramps on my computer that that is the reason to put on a raspberry pi as server. I can connect to it with VNC but it is not my ideal use case and try to avoid it (I prefer command line through SSH over graphical and VNC).
At present time, I had installed the gramps application on the raspberry (in one of the attempts to get the web working) and on the last configuration I did for the docker-compose I do not use any of the folder/files from the desktop app. How should the docker-compose be configured in order to be able to use both front-ends over the same data? (should this go on another topic?)

Nonetheless, with your answer, I will have to make some organization afterwards. You mention the possibility to move and rename the files manually, won’t that break the links on the database?

Regarding the security issues you mention, I wasn’t expecting to have a “file chooser” showing me the files on the server. I was having in mind the possibility to select a file on my local computer (and why not an URL), and then having some properties to add to it such as: name to store and relative location (base on the location of the media folder on server). Then the backend would have created the missing folders (if any) and copy the file from my local computer (or URL) to the destination forlder on the media directory. The media directory won’t be exposed directly. Eventually if the creation of folder can be a security risk, an admin panel to specifically do so or a manual creation of the folder (ssh) could be done on another step (personally I do not create folders constantly, rather the opposite).

Jorge

You can use it as standalone, what I just meant is that you should not expect it to be on feature parity with Gramps Desktop, so you might find things that you want to do but cannot do with Gramps Web (yet).

How should the docker-compose be configured in order to be able to use both front-ends over the same data? (should this go on another topic?)

If you use both Web & Desktop, you should use the Sync Addon.

I was having in mind the possibility to select a file on my local computer (and why not an URL), and then having some properties to add to it such as: name to store and relative location (base on the location of the media folder on server).

I understand, but it’s not trivial to implement that in practice. You would have to handle what happens if the file already exists (both in the backend and the frontend). You would have to make sure the location provided is not outside the media base folder. And some more subtleties like that. By the way, if you want to use Gramps Web standalone, why do you care about the structure of the media folder?

1 Like

One more subtlety I forgot to add and which was actually the main motivation for the current implementation: in my case, I am using a media folder which does not only contain the Gramps media files, but lots of other stuff as well that Gramps doesn’t know about. What if somebody now adds a file via Gramps Web that has the same file name as a file I have locally (but the server doesn’t know since it only has the files that are Gramps media objects) and I run the synchronization. What to do now? Delete my local file and overwrite it? Fail the sync (but then what)?

Eventually, I think managing file names & folders is inherently a desktop task and should not be a focus of Gramps Web. Servers serving many users will anyway want to use media files on S3 rather than local files.

I understand better ow all the implications. Thanks for that!

By the way, if you want to use Gramps Web standalone, why do you care about the structure of the media folder?

My concern is related to my other question: in case I do have to stop for a time or some hazardous event (fire, computer brake…) I would not want to redo from scratch and having files with hashname I don’t understand would require me to look to the image, video, document and try to figure it out the type of document, year, source, etc.
My concern is not on the daily operation but rather on the hypothetical “what happens if…”, can I start from where I left or start over?

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.