Jump to content
TNG Community

automation


Snakeskin

Recommended Posts

Snakeskin

Hello TNG specialists,

I'd like to automate something. Is it possible to automatically add a picture when the cause of death is listed as "Stillborn"? So, where other children have a portrait picture, I'd like a picture for stillborn babies as well, but there would be too many to do manually.

Would this be possible, and if so, how? I can't do it myself, but perhaps someone here can.

Thanks, Andreas

stillborn 1.jpg

stillborn 2.jpg

Link to comment
Share on other sites

Hello Andreas,

I sometimes run maintenance operations in media administration on this page.admin_thumbnails.php.

There I can add a default thumbnail to any person who does not already one. Provided there is at least one media for the person, even if there is no photo. The TNG script will add as default the 1st media it meets, Generally the birth or death certificate. Beware not to choose the option "Regenerate existing thumbnails".

It's not exactly what you meant, but it will be done without modifying any existing code.

Here is what one can display For baby Marie Louise, I have only her birth certificate. For grown-up Marie Louise, I have only her photo on a group wedding photo.

image.png

 

Edited by Katryne
typo
Link to comment
Share on other sites

Hey Andreas, I tried something on my database that worked (from the phpMyAdmin tool):

First, insert records into the medialinks table for all of the people that match your criteria (whatever field has the "stillborn" text). In this example, I assumed it was in the 'title' field:

INSERT IGNORE INTO tng_medialinks (personID) 
SELECT personID FROM tng_people WHERE tng_people.title LIKE '%stillborn%'

This will insert a medialink record for every person you marked as stillborn (with no other columns updated yet):

Screenshot 2026-02-03 064833.png

Second, update the new records with the rest of the missing info, most importantly the mediaID for your image that represents a stillborn child.

UPDATE tng_medialinks SET 
mediaID = 855, gedcom = 'YourGED', defphoto = 1, linktype = 'I', ordernum = 1
WHERE gedcom = ''

You would replace the mediaID and gedcom parameters with your own values, and I used the WHERE clause of gedcom = '' but it could be several other fields in the new records that don't match your others.

Hope this helps,

Cheers

 

GOGGS

Link to comment
Share on other sites

  • 2 weeks later...
Snakeskin

Hi GOGGS,

Thanks for your tip.

But I'm not sure I understood it correctly.

Could you describe it to me in detail, step by step?

Two more questions:

1. What do you mean by title? It's under Death / Cause: Stillborn Child.

2. What does Media ID mean and where do I get it?

Thank you for your help.

Best regards,
Andreas

P.S. You can also email me at:
Snakeskin@t-online.de

Link to comment
Share on other sites

On 2/13/2026 at 3:39 AM, Snakeskin said:

1. What do you mean by title? It's under Death / Cause: Stillborn Child.

2. What does Media ID mean and where do I get it?

1. Great - you're storing cause of death where it should be (some people put stuff in different places, or their GEDCOM import does). The updated SQL to use in phpMyAdmin to insert a (empty) medialink record (with blank or 0 values in many fields) for every person with cause of death like 'stillborn' is:

INSERT IGNORE INTO tng_medialinks (personID)
SELECT DISTINCT p.personID FROM tng_people p 
INNER JOIN tng_events e 
ON p.personID = e.persfamID 
INNER JOIN tng_medialinks m 
ON e.persfamID = m.personID 
WHERE e.parenttag = 'DEAT' 
AND e.cause LIKE '%stillborn%'

2. I presumed that you already had 1 person that had an image representing that they were stillborn. If you don't, add that image to one person. Use that person's info to mass update the other records added in step 1. To find the info for the 1 person that you have the image representing 'stillborn', use that person's personID to get the mediaID, or look in your media table for the mediaID that matches the description or filename you used for the image. To connect that image through its mediaID to the blank records created in step 1, use the SQL:

UPDATE tng_medialinks SET 
mediaID = yournumber, gedcom = 'YourGED', defphoto = 1, linktype = 'I', ordernum = 1
WHERE gedcom = ''
/* yournumber is the mediaID for the image representing stillborn,
   'YourGED' is the gedcom name for your tree
*/

Let me know if this helps, otherwise we can take it offline.

Cheers

 

GOGGS

Edited by GOGGS
Updated SQL
Link to comment
Share on other sites

Snakeskin

Hi Goggs,

thanks so much... I´ll try... when I have a little more time.

Iwrite you back, when I need more help.

Thanks a lot, have a nice day

Andreas

Link to comment
Share on other sites

Snakeskin

Good morning Goggs,

So, I've now inserted the person ID (I202093) and the image for one person (Baby Fritz 1960). The media ID is (41026) and the GEDCOM is (02).

INSERT IGNORE INTO tng_medialinks (41026)
SELECT personID FROM tng_people WHERE tng_people.title LIKE '%stillborn%'

UPDATE tng_medialinks SET
mediaID = 41026, gedcom = '02', defphoto = 1, linktype = 'I', ordernum = 1
WHERE gedcom = ''

Is that correct so far?

If so, where exactly do I need to enter this?

Best regards

Andreas

Link to comment
Share on other sites

Hopefully when you installed the MySQL db, the tool called phpMyAdmin was installed with it. If you simply add phpMyAdmin (case-sensitive) to the end of your website address, e.g. mysite.com/phpMyAdmin you will launch the tool and get the sign-on screen where you can add root as the username and your root password. If you've never used this tool, we might need to take this discussion offline to help.

If you have, the first query you would run is this:

INSERT IGNORE INTO tng_medialinks (personID)
SELECT DISTINCT p.personID FROM tng_people p 
INNER JOIN tng_events e 
ON p.personID = e.persfamID 
INNER JOIN tng_medialinks m 
ON e.persfamID = m.personID 
WHERE e.parenttag = 'DEAT' 
AND e.cause LIKE '%stillborn%'

This will add empty records in the tng_medialinks table for each person marked stillborn. Then to attach your image and update the records, you would run the SQL which you had correct:

UPDATE tng_medialinks SET
mediaID = 41026, gedcom = '02', defphoto = 1, linktype = 'I', ordernum = 1
WHERE gedcom = ''

Hope this helps

 

GOGGS

Link to comment
Share on other sites

Snakeskin

Hi Goggs,

This is my page.

I've never used this tool before.

We can discuss this offline if you like. Perhaps via email or WhatsApp?

Thank you.

I don't even know where to enter that.

Sorry
Andreas

Screenshot (667).png

Link to comment
Share on other sites

That's the right tool. I'll send you a mail message in this forum.

 

GOGGS

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...