Still no relative media paths possible after 30 attempts

Gramps version: 5.2.2 Linux Mint LMDE 6 Over the last two years, I have probably made about 30 unsuccessful attempts to implement the suggestion to simplify the media paths. I have made every effort to follow the relevant instructions, but in each case all the images have become invisible. I would ask you to provide clear instructions. It shouldn’t be that difficult. I will describe my actions below:

  1. importing a file “tree.dpkg”.
  2. move media folder from “/home/rainer/tree.gpkg.media/home/rainer/Ahnentafel” to “/home/rainer/Ahnentafel”
  3. Open Tools >Service programs >Media management (german: Werkzeuge >Dienstprogramme >Medienverwaltung
  4. Select (first item) “Replace substring in the path” (german: Ersetze Teilzeichenfolge in dem Pfad)
  5. In “Replace” I put in “/home/rainer/tree.gpkg.media/home/rainer/Ahnentafel”.
    In “With” I put in “/home/rainer/Ahnentafel”.
  6. After closing the window all images are exchanged by an icon of mime type.

I came to the conclusion that it is impossible to customize the media path relatively. To be able to use the program I have to let go any attempts to change paths.

However, it should be possible. Otherwise there wouldn’t be a recommendation for it to do.
Where can I find a really absolute working how-to? The howto offered in Gramps help pages doesn’t work for me.
Thank you in advance for a fine solution!

Update: If I check properties of an image, the simplified path is displayed. Does that mean I have nothing to do? Why then popped up the recommendation for a path change?

It is hard to guess at what went wrong, especially since a single spelling error or even not matching a single capitalized letter can break the environment’s link to a file. If you moved the entire media directory graphically using the file browser for your desktop environmental, it should have moved all the images and subdirectories automatically. Here’s a couple ideas:

  1. If you used the “mv” command manually with CLI, then it should have been recursive. However, if you used the “cp” command manually in CLI, it is not recursive unless you add the recursive option.
    cp -r /home/rainer/tree.gpkg.media/home/rainer/Ahnentafel /home/rainer/
  2. Did you notice that I left the “Ahnentafel” directory name out of the destination path in the above cp command? Make sure that there is no Ahnentafel subdirectory within /home/rainer/Ahnentafel, it is a really easy mistake to make.
  3. If you have a system installation of Gramps from source, deb, or repository, use the “Prerequisites Checker” addon for Gramps to make sure that all necessary prerequisites for viewing previews and images are accessible to Gramps.
  4. Go into the “Media” selection on the left side of Gramps, and look at the directories listed for the image files. Also check on whether there is an image preview showing at the bottom of the screen. Then click the “+” icon at the top and manually add a random picture. Then after verifying that a preview shows for the new media file you just added, compare the directory path that worked for the new media file to the other directory paths that did not work. Here is an example.

    The above screenshot of a media preview in Gramps is from Fedora 40 Gnome with the Gramps 5.2.2 flatpak. You could try a Virtual Machine on your computer with an OS using Gnome (Gnome Boxes is one example that I believe is installable on LM through their repository), or perhaps if you have another computer with a different OS that is using Gnome, you could test on that computer if the steps you have been taking work with Gnome. If they work with Gnome but not Linux Mint LMDE, then please file a bug report at the Gramps Mantis site.

Thank you for your comment. I do not use CLI, but GUI File Manager, where I have moved the folder “Ahnentafel”. “mv” or “cp -r” are commands that I don’t really know, but at most copy and then use.
Without simplifying the path successfully, the simplified path already exists under “Properties” of any image. I wrote that in the first post as an update. The question arises: Maybe the simplification has already been done somehow? So no need for action? Unfortunately I don’t see through the whole thing.
That’s why I tried to simplify the path and failed.

Yes, I did notice that you were checking “Properties” to check the directory path. My first two suggestions related to actual image file location on the hard drive, and verifying there is no typo or unintended subdirectory involved. This is a very common mistake that even experienced linux users will occasionally make, and should always be one of the first steps in troubleshooting an issue like this regardless of how intelligent or careful someone is. I was not trying to be condescending or insulting, it really is a common mistake because humans make typos occasionally.

However, the fourth suggestion is an actual troubleshooting test. Instead of checking the actual image file location on the hard drive like my first two suggestions as well as when you check “Properties”, my fourth suggestion is instead checking where Gramps is looking for that image. Furthermore, the troubleshooting step I suggested in adding a media file through Gramps is a test to check if your Gramps setup has both the correct directory permission and the prerequisites to display an image preview. Therefore, if the preview does appear when the media file is added manually through Gramps, then you will have established that there is a hard to see mismatch between the actual image file location for your Ahnentafel media directory and where Gramps looks for those image files.

1 Like

I added an image to a gallery, Gramps opens the folder with simplified path “~/Ahnentafel”, and the preview does appear.

I also added an image using the “original path” created with Import (/home/rainer/tree.gpkg.media/home/rainer/Ahnentafel). That is working too.

However, I have not yet understood what is meant by “mismatch”. Both directories exist parallel, and Gramps is using the simplified one.

So there is no need to change anything, although Gramps recommends this when loading the master file for the first time. If I had ignored this message, I would have been spared a lot of unnecessary work.

Hallo Rainer,

There are two things that I missed in your story, and they may both be relevant. One is, that I didn’t read anything about relative paths. The media manager can change your paths to relative, when they start with the path that’s in the preferences, and that path is supposed to be right after an import with media, even though it is a bit long. When you run that conversion, before moving any files, they should still be OK.

Another thing is, that you can see which paths are relative, by checking the contents of the media tab, or category. In there all paths that start with a /, or C:\ on Windows, are absolute, and relative paths don’t start with that.

I have my base path set to /home/enno/Documenten/archief, and since my family pictures are all in a sub folder named familie, their paths all start with famile/, without something like /home/enno at the start.

At this moment, I am also working on LMDE 6, so I know Nemo, and it is perfecly OK to use that to move your files. And in case of a restore of a backup with media I recommend that you start with converting all paths to relative with the media manager, and check that they are indeed relative. You can also run a the Check & Repair tool for verification.

Then, when you’re sure that Gramps can find them all, close your database, move the files to where you want to see them, and then open the database, and change the base path to where you moved your files.

That should be it.

Enno

My problem is that I can’t follow your instructions either. It seems that it is very important to make the necessary settings in the right order.

  1. first I add a new family tree and name it.
  2. I load this new family tree. It is still empty. What do I do now? So far, I have imported the backup file as the next step
  3. In doing so, I get the famous recommendation that gives me so much trouble. But the backup is imported successfully. What exactly do I do now? (I have already followed hundreds of instructions of any kind, and this feels like the first one I have failed so often because the terms used are too vague in my eyes).

If I specify a path in the preferences before the import, then there is a conflict, and the import file is simply located in the preset directory including the cumbersome path. This cannot be the case.

So what exactly do I have to do after the import? So far I have used the media management to replace the paths. But all the preview images that were there before have disappeared.

I really would appreciate to get a step-by-step advice as part of the “after-installation-first-steps”.
When I installed and used Gramps the first time, I succeeded in changing the path. But with all family trees I then added, also on a second PC, I failed.

For practical purposes, my 1st advice would be that you stop using backups with media, because they look easy, but will always restore files in places that you won’t really like. It is often far easier to copy media from one machine to another via an external drive, or a cloud service. I use both.

In principle steps 1 and 2 are right. You can also double click a .gpkg file in Nemo, which will start Gramps, create a new file named after the backaup, and import it, but the problem with that is that it does all that in silence, without a progress bar or anything.

For step 3, it helps if you don’t specify a path before the import, to avoid a conflict, but if you did, it’s not fatal if your original tree had absolute paths, because in that case the path will be ignored anyway.

Step 4 is that you check that the media files were restored in the right place. somewhere inside that tree.gpkg.media folder. And if you see a new home folder there, and nothing else, it prooves that you had absolute paths in the original.

If that’s OK, your next step is to run Check & Repair to see whether the restored tree is OK, and whether all the media are actually there. And if they’re not, you have a choice between telling Gramps where they actually are, one by one, deleting the paths, or keeping them. And I suggest that you do the latter, and click the checkbox, so that Gramps keeps all the paths without further questions.

If this is OK too, you may use the media verify tool to generate checksums for all files. They may already be in the database though, so it is not necessary.

Now, if everything was OK now, and all files are inside “/home/rainer/tree.gpkg.media/home/rainer/Ahnentafel”, meaning that there is no other folder at a higher level, you can set the base media path to that same long name, i.e. “/home/rainer/tree.gpkg.media/home/rainer/Ahnentafel”. And then, you can use the Media Manager to convert all paths from absolute to relative. And after that, you should still see thumbnails for all files. You should also see that the paths in the media tab are much shorther now, and only show bare file names, or paths within the Ahnentafel folder, without slashes in front of them.

If everything was OK until now, now is the time to move your Ahnentafel folder to where you want it, and change the media path accordingly. And then, your thumbnails should still be OK, and Check & Repair should show positive results.

I have now followed this several times without achieving the desired result.

  1. I have moved the folder “/home/rainer/Ahnentafel”.
  2. I have changed the base media path to “/home/rainer/tree.gpkg.media/home/rainer/Ahnentafel”
  3. I used the Media Manager to convert all paths from absolute to relative.
  4. All thumbnails were gone!
  5. I changed the base media path to (the original) “/home/rainer/tree.gpkg.media".
  6. All thumbnails appeared again.
  7. I used the Media Manager to convert all paths from absolute to relative.
  8. That had NO EFFECT! In Media category all files are displayed as such: "/home/rainer/Ahnentafel/xxx.png.

Again, there is no gain from any of the proposed measures. Either it goes completely wrong and the thumbnails disappear, or it stays as it is.

I then started a completely new attempt by creating a new family tree with a current backup. After the import, a window appears with the following text:

Basispfad für relativen Mediensatz
Der Basismedienpfad dieses Stammbaums wurde auf /home/rainer/test.gpkg.media gesetzt. Du solltest einen einfacheren Pfad wählen. Du kannst dies in den Voreinstellungen ändern, während du deine Mediendateien an die neue Position verschiebst, und mit dem Medienverwaltungswerkzeug die Option “Teilzeichenfolge im Pfad ersetzen” verwenden, um korrekte Pfade in deinen Medienobjekten festzulegen.

Translation:

Base path for relative media set

The base media path of this family tree has been set to /home/rainer/test.gpkg.media. You should choose a simpler path. You can change this in the preferences while moving your media files to the new location and use the “Replace substring in path” option with the media management tool to set correct paths in your media objects.

The term “while moving” is inaccurate. Is it before or after using media manager? And I found out, that ANY real moving of media files of the original “home/rainer/test.gpkg.media” subfolder “Ahnentafel” makes the thumbnails disappear.

And setting “/home/rainer/test.gpkg.media/home/rainer/Ahnentafel” as base media path doesn’t work either.

Conclusion after that test:
Any change of base media path doesn’t work.
Creating a simpler path works, if I don’t move any files. All media files have paths starting with “home/rainer/Ahnentafel…” without “/” in the beginning. They seem to be relative.
Adding any new media file - an image - to Media shows an absolute path however.

Hallo Rainer,

When you’re working with paths, you need to be very precise, especially when we’re working from a distance, where I can’t see your screen. I am a software engineer with Asperger’s, and that gives me an excellent eye for detail, but that doesn’t help much, if I don’t see you screen.

And here’s the important point that I didn’t see in your 1st message, and that is that all paths are relative. I forgot about that, because I never use backups with media, but it is true. A restore of backups with media always creates relative paths, because that is the only way to prevent overwriting.

This means, that you can use the media manager, but you need to take care that the string that you type on the 1st line starts with ‘home/rainer/’ without the slash. And if there are no files outside the Ahnentafel folder, you can choose to replace ‘home/rainer/Ahnentafel’ with ‘’, meaning an empty string.

If you do that, the thumbnails will disappear, because the new file names can’t be found in the folder mentioned in the base path. That’s natural.

They shoud reappear however when you move your Ahnentafel folder from its restored location to your home folder, and change the base path to ‘/home/rainer/Ahnentafel’.

This means, that you can use the media manager, but you need to take care that the string that you type on the 1st line starts with ‘home/rainer/’ without the slash. And if there are no files outside the Ahnentafel folder, you can choose to replace ‘home/rainer/Ahnentafel’ with ‘’, meaning an empty string.

Do you mean the whole thing with simplify the path is only to replace ‘home/rainer/Ahnentafel’ with ’ '?
I thought is would be replacing of ‘home/rainer/test.gpkg.media/home/rainer/Ahnentafel’ with ‘home/rainer/Ahnentafel’…
If so, then all confusion of mine is caused by this missunderstanding.

My main intention for this post is to get really clear instructions for anyone using Gramp. Thank you, Enno, for your detailed descriptions to help me find my way.
How would you formulate official instructions for anyone who has loaded a fresh family tree and imported a Gramps backup file including media to simplify the path?
This would probably help everyone best.
Basis:

  1. name of the family tree: family tree
  2. name of the backup file: familytree.gpkg

Please start with first step after import (and getting the “simplify-path-message”). And then a step by step advice.

Thank you!

I have stayed away from this thread because I am not on Linux. I am Win10.

Some basics.

The Base Media Path plus the Path in the media records combined creates the full path to the raw file on your hard drive. The goal is to make that happen.

The problem is you imported a backup including the media files. The import created the folder tree.gpkg.media (the name of the backup file) and stored the files in subfolders based upon the path stored in the backup file.

Step One is to determine where you actually want your media files stored. From the thread I gather you want them stored in /home/rainer/Ahnentafel Notice I make no reference to the folder tree.gpkg.media/....

Step Two is to move your media files and any subfolders from /home/rainer/tree.gpkg.media/home/rainer/Ahnentafel to the /home/rainer/Ahnentafel folder. If files are stored in necessary subfolders keep them in these subfolders as you move them.

Step Three is to set your Base Media Path to /home/rainer/Ahnentafel

Step Four is to edit the Media Record’s path field to be just subfolder/filename.jpg The Media Manager tool allows you to make string substitutions to edit the path fields. If all you need to do is remove information from the path field you can leave the Replace With field blank.

Step Five is to install and use the addon Media Verify tool. Using the tool’s Generate option, it will update the checksums of the media record with the raw file on the hard drive. As it does this, it will alert you to any raw files Gramps cannot find. With the checksums set, the tool’s Verify option will find the files again if you ever move or rename them.

Step Six! Once you are satisfied that Gramps has found all of your media files in the folders you want, DELETE the tree.gpkg.media folder and any of its remaining subfolders.

I only use the backup file with media when I need to create a partial tree with just the needed media files. Doing this with Export selects just the wanted media files. For my own purposes, I only use the .gramps with NO media backups of the database. These get stored off my hard drive. I also backup the media files to an external drive.

For reference my Base Media Path is c:\Users\Public\Genealogy\Media (on Win10). In the Media records the Path field will be something like Birth\filesname.jpg or Death\filesname.jpg etcetera.

EDITED: Thank you @ennoborg for helping with the Linux /home correction.

2 Likes

Almost. The base path is an absolute path, so on Linux and macOS, it must start with a /. And that will be added automatically, if you use the folder selector to set it.

Second, for anyone moving between Linux or macOS and Windows: Most times, Gramps is smart enough to deal with a mixture of forward and backslashes. So, if you have file paths with slashes, which I think is normal for relative paths, even on Windows, it can add those to a base path stored in Windows format, and still find all files.

This is why I said I stayed away from this thread. I do not know the intricacies of Linux. Give me DOS anytime.

True. My problem is I use the Path field as the first field in the Media view and thus the default sort. Before Type Cleanup I would do a clean import of the last backup to remove the unwanted types etc on a regular basis. On import the media path would store as “/”. Adding a new media record would store as “\”. This would always mess with the sort order and until I remembered I needed to fix the paths, I would be looking for the new file I just added in the wrong part of the list and wondering why it was not there.

1 Like

Yes, now it is solved. The steps DaveSch describes are in an understandable way for me. And me too found out that the slash “/” has to start the basic media path.
It is equivalent to your backslash in “c:\users”.

Now, with insight how it is meant, it is logical and easy to get.
I hope the tutorial will improved if it’s not only me struggling with it.

Thank you both to let me dive deep enough to get it solved!

As one of the people who often adapts forum information into the wiki, I’m going to opt out of working on this thread. Any other volunteer?

(I rarely work with media and something like this someone truly interested in the subject. A good documentation process typically leads to creating bug reports and feature requests to improve the workflow.)

Exactly. The media manager only works on the paths that are stored in the tree, i.e. the ones that you can see in the media tab. And if those are relative, meaning that they don’t start with / or D:\, where D can be any drive letter on Windows, they are concatenated to the base path.

If the base path is not specified, Gramps will use whatever is defined as its home, which is your home folder on Linux, or your users folder on Windows. And that means that a restore with media on the latter will create a .media folder inside C:\users\yourname, where it is often invisible, because on Windows, you tend to be focussed on well known folders like Documents and Pictures.

We have official instructions all over the place, so I won’t add them here, but I do understand the problem. And IMO they work best, if we can help you to visualize things. But that itself is a problem, because your situational awareness can be quite different from mine. It’s a bit like the difference between people that always get lost in a city, and those that don’t. For me the experience is, that I can only help you, when I see what you see, or at least can imagine what’s going on in your mind.

You can help us, by reading this page on the wiki

https://www.gramps-project.org/wiki/index.php/Media_Management

and following the links at the bottom. They go everywhere, and some link to the official manual, which has translarions for other languages. That’s where the work starts.

Yes I’ll do that. I’ve already skimmed through it to some extent. One of the main problems for me is its complexity. I already know this from the Ubuntu Wiki. The authors want to compile and present everything relevant to the topic, which often means that the user has to study things that don’t interest him at all.
Further down I suggest where to put the relevant recommendations for export.

First of all, it may be useful if I briefly outline the origin of my problem: When I start the first family tree, I do not yet have any image files. The problem does not exist.
Only after I had installed Gramps also on my notebook and wanted to take over the media that had accumulated in the meantime did this recommendation (with the simplification of the paths) appear on the screen.
This means that I have automatically selected export including media.
When importing on the notebook, I got a folder “/home/rainer/tree.gpkg.media”. Without checking it further, I assumed that it contains everything that belongs to Gramps, and not just the media.
This error in thinking led to the problem. Even though “media” is clearly legible, I interpreted it as a total import including media. A typical newbie issue.

DaveSch’s idea of doing the export without media and importing the media, which are in an external directory anyway, into the new computer makes much sense to me and I would adopt it now.

To summarize, I think it makes sense to accompany the Gramps user with a suitable recommendation when attempting to export the data. The subsequent recommendation to simplify the paths comes too late and has to be modified a bit to get it clearer, by using examples for Windows, Mac and Linux.

The page that opens when you click on Export should already contain clear recommendations. Both for export without media and with media.
So far, the only focus on this page is on the question of whether a backup is necessary.

So far, the task of using an export file to transfer the selected family tree to another computer or to separate out a specific part of the family tree (as I have just done with my cousin’s mutual relatives) has been ignored.

In my opinion, a reference to the wiki would be less helpful than putting the necessary instructions on the start page of the export window.

I know what you mean, and when people ask, I allways advise to export without media too. And I might have set that choice as the default in my own Gramps version too.

My personal view is that the instructions on the page that you showed are already too long, and things on the wiki are quite hard to find, and often not easy to read, because they focus on everything that you can do, instead of on what you should. And that’s quite a different thing.

Creating examples is a difficult thing, because you need to test them on all platforms, preferrably with pictures in all languages. And they only work for a part of the users, partly because they can be quite long. People that like to explore things, like I do, will probably skip them.

Yes, I agree with you. However, I have now looked into it more closely. In the menu under “Family trees” there is “Export…” and “Create backup…” The window that opens when you click on “Export…” has the misleading title “Save your data”, although it is primarily about exporting and inserting the data into other programs.
The small pop-up that opens when you click on “Create backup…” opens without an introduction and offers the choice of with or without media. But that’s just by the way.

Import is where it gets interesting and more important. There could also be a short introduction during the very first import, in which it is made clear which folders are created. That when importing a Gramps file including media, a directory “xxxx.gpkg.media” is created which ONLY CONTAINS THE MEDIA and can therefore be moved or the path changed.

If you are interested, I could draft a corresponding text.

1 Like