LeslieP Posted November 26, 2019 Report Share Posted November 26, 2019 I have finally found a way to get my media files assigned to the proper custom media collections during the GEDCOM import process. It does require a "hack" to the gedimport_misc.php file, maybe someday the capability can be made standard by Darrin, or turned into a mod, but for now, this is a HUGE thing for me. I've never cared for the documents/video/recordings collections, always wanted to use my own collections and menu items. Since I use TNG just for display, and frequently clear the tree and reimport from GEDCOM, I needed the placement of files into collections to be automated and not manual. Now it is. I wrote it up in a longer blog post with lots of screen shots, and I'm afraid it probably still doesn't make too much sense, but thought I'd offer it here for anyone looking to do this. Say I have images of birth certificates and the like on my desktop in P:\Genealogy\exhibits\birth_records, and my genealogy program (RootsMagic) puts that entire path in the GEDCOM file. I really want to have a media collection and menu item called "Birth Records", and for the GEDCOM import to put those files in that collection for me. Here's how make the server folder structure similar to the desktop folder structure on desktop: P:\Genealogy\exhibits\birth_records on server: tng/documents/birth_records create the collection in TNG Admin>>Media collection ID: birthrec display title: Birth Records folder name: documents/birth_records add code to customconfig.php defining this collection and the gedcom file path$locimppath['birthrec'] = "P:\\Genealogy\\exhibits\\birth_records"; edit gedimport_misc.php to add this collection ID and import path info to the getLocalPathList function This is what gedimport_misc.php section looks like original: function getLocalPathList($mediatypeID) { global $locimppath, $mediatypes_locpaths; switch( $mediatypeID ) { case "photos": $locpath = $locimppath['photos']; break; case "histories": $locpath = $locimppath['histories']; break; case "documents": $locpath = $locimppath['documents']; break; case "headstones": $locpath = $locimppath['headstones']; break; case "recordings": case "videos": $locpath = $locimppath['other']; break; default: $locpath = isset($mediatypes_locpaths[$mediatypeID]) ? $mediatypes_locpaths[$mediatypeID] : ""; } return $locpath; } You need to add a "case" section for your new media collection. This is what you add: case "birthrec": $locpath = $locimppath['birthrec']; break; Do that for every additional media collection you have created. This is the longer blog post about this technique https://lptex.com/blog/tng-custom-media-collections-using-gedcom-import/ Here's what I see after I do a GEDCOM import and then run the secondary process to trim menus And this is what the menu looks like on the live site I'm working towards the TNG-WP integration and will not be using the TNG menus at all, so I didn't bother with any menu icons. I hope this helps others as much as it has me - this is something I've wanted for YEARS and finally sat down to figure out how to do it myself. Quote Link to comment Share on other sites More sharing options...
TBirdUK Posted January 23, 2020 Report Share Posted January 23, 2020 On 11/26/2019 at 4:35 PM, LeslieP said: I hope this helps others as much as it has me - this is something I've wanted for YEARS and finally sat down to figure out how to do it myself. It has certainly helped me, many thanks for this delightfully clear explanation of the process, I estimate this will save me hours a week. Wouldn't it be wonderful if someone with the skills turned this into a mod that used the tng_mediatypes table as source and configured the 2 files automatically? Quote Link to comment Share on other sites More sharing options...
fluffy82 Posted January 23, 2020 Report Share Posted January 23, 2020 This seems overly complicated. I use the same tree structure in Family Tree Maker on my PC as on the server of my website. Never had any problems at import, the media always link to the correct folder and hence collection. Quote Link to comment Share on other sites More sharing options...
LeslieP Posted January 24, 2020 Author Report Share Posted January 24, 2020 It IS complicated, stupidly so. I've always had fully functional media links, just not the collections. I clear my tree prior to an import, which removes all the media. Before I did this convoluted setup, collections were empty, the import would not put the files into the collections. Is there some easy way to do that? Quote Link to comment Share on other sites More sharing options...
TBirdUK Posted October 16, 2020 Report Share Posted October 16, 2020 thanks again, having just upgraded to v13 site I spent a stupid amount of time trying to remember which mod I had installed that routed the media types correctly! Not sure if v13 is attempting to do the same thing as the code in gedimport_misc.php has changed a lot, but it is not working for my Gedcom? Quote Link to comment Share on other sites More sharing options...
Michala Posted March 22, 2021 Report Share Posted March 22, 2021 @LeslieP Hi, I'm new to TNG (just picked it up this weekend so I am running v.13.0.3) and have been tearing my hair out regarding custom collections and the import process after trying various things I found this post and tried out your process. It worked beautifully first time! Many many thanks to you! Quote Link to comment Share on other sites More sharing options...
RWN Posted September 17, 2023 Report Share Posted September 17, 2023 @LeslieP your post here and particularly your blog post linked herein are extremely useful for me. THANK YOU!! Might anyone know if the php file-edit procedure works the same with v.14? Lealie’s use-case is EXACTLY that of my own, which is to say; I desire zero-maintenance semiregular tree imports to TNG that will nevertheless accommodate custom collections (created in TNG prior to import) and render associated media without manually servicing the media files (for custom collections) in TNG after each import. It appears the .php file edit is the answer I’ve been looking for. I use Reunion and TNG v. 14, but our end goal is the same. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.