UksusoFF/webtrees-faces

Add Age of when photo taken

Closed this issue ยท 17 comments

what about if we add the Year the photo was taken. then when we tag the person it could work out there age base on birth

I'm adding already the date a picture was taken using a _DATE tag.

Thanks, Bro could we have the option to add manually Year

Just that the Photos I'm uploading are Photos of the photo so _DATE would be wrong

Yes, I'm adding the date a picture was taken manually. Sometimes the date is written on the back side of the photo. Or I know the event when the photo was taken. Since the GEDCOM standard 5.5.1 does not allow storing the date, I have to use a NOTE or a custom GEDCOM tag like _DATE.

I agree that it would be nice if the faces module would show the age of the tagged persons in a picture together with their names. This could help to be sure that the identification of the persons is correct.

Faces can show date from fact attached to photo.
So it's not so hard implement age on titles.
I will try implement it when possible.

My thinking would be to add the Year to the Notes field

image

new note data looks like this
Y2005, X9, X10, X2, X11, X16, X55

I'm thinking the logic looks at that split it by the , if the first array has a Y then do the maths base on the X??

Would like to know what files you are changing to get to work?

I do not understand what you mean. The date a picture is taken is an attribute of the picture. So it has to be stored as a GEDCOM tag in the OBJE record of the picture.

At the moment the data of the faces module is stored in a database table and cannot be exported as GEDCOM. This makes it complicated when transferring data to another installation of webtrees. This was ok, because there was no standard defined for that. Now there is GEDCOM 7 and so we have a standard for exchanging data like the position of "faces" in a picture. So I suggest orienting the module on that. even if webtrees is following the GEDCOM 5.5.1 standard up to now.

@hartenthaler
GEDCOM 7 is supported with webtreees? Can you give example of this?

webtrees is still supporting officially only 5.5.1. But there are already several 7.0 structures possible.

You can import GEDCOM 7.0 in webtrees (but not gedzip format) and export it without any errors (see German webtrees manual).

Support for GEDCOM 7.0

  • TIME is supported under DATE, so you can use time of birth or death; for example INDI:BIRT:DATE:TIME
  • you can export GEDCOM files in zipped format (GEDCOM file together with media files)
  • you can use RESN in all types of records
  • you can use FAM:FACT already now
  • you can activate the tags and rules of the GEDCOM-L group in webtrees; several definitions in this addendum to the GEDCOM 5.5.1 standard got part of GEDCOM 7.0
  • regarding sex: additionally to M, F, and U you can use "X" as it is defined in GEDCOM 7.0
  • all the enum fields are using already UPPERCASE, like in NAME:TYPE ("BIRTH") or when defining the OBJE:FORM tag (JPG instead of jpg)
  • the new tags EXID and SNOTE are supported
  • and many more ...

@MYLE-01
Check latest master version
image

long time no see
i understanding more about this now I add a photo as a fact added the Date which shows when I display that image like that bit

image

what I would like to see age of me when that photo taken as I add 01 DEC 2002 using the date field in the fact
as It knows my birth 1965 and the date is 01 Dec 2003 would like the Age @ Photo to say Age @ photo 37

Been Playing no nothing about PHP but after some reading got this working well sort of seeing what it would look like

in

function getMediaMapForTree(

change the 'age'=>

'age' => (strlen(trim(strip_tags($person->lifespan()))) > 6) 
			? 2004 - (substr(strip_tags($person->lifespan()),0,4) + 0)	
			: 'Missing DATES', 

I know its Not the correct way of do it. Shit it looks good when you mouse over you see there age
working on finding that fact date then replacing the 2004 with the fact date.

know this is not the correct way could you give some links where to start reading.

my think ill have to put it in the

function getPersonDisplayAge

and change the maths logic a bit...

image

image

now looking at it on screen think ill drop lifespan for live people but show it dead people

found this

function getMediaMeta
...
...
...
$fact->attribute('DATE'),

is that putting the date of the FACT into the $fact ....... hope so

just need to work out how to pull that value out..

have no idea what I doing but enjoying it.

made this fuction

    private function getPersonDisplayAgePhoto(Individual $person, $fact, $media): string
    {
        if (strlen(trim(strip_tags($person->lifespan()))) > 6) {
            $birthyear = substr(strip_tags($person->lifespan()),0,4) + 0;
        }
        else {
            return I18N::translate('Missing Birth');
        }
        
        $Photoyear =  2018; 
        
        $birthyear = $Photoyear - $birthyear;
        return $birthyear ;
    }

still can't get the DATE from the NOTE :(

I have fix it and working

    private function getPersonDisplayAgePhoto(Individual $person, ?Fact $fact): string
    {
        if (strlen(trim(strip_tags($person->lifespan()))) > 6) {
            $birthyear = substr(strip_tags($person->lifespan()),0,4) + 0;
        }
        else {
            return I18N::translate('Missing Birth');
        }
        if (empty($fact)) {
            return I18N::translate('Missing fact Date');
        }

        $Photoyear =  substr($fact->attribute('DATE'),-4) + 0; 
        
        $birthyear = $Photoyear - $birthyear;
        return $birthyear ;
    }


hope I done the updating to here right

Tested on home server work

What is the final decision how to define the date when the photo was taken? Is it stored in the media object (OBJE:_DATE)?

After some additional tests: I found that the DATE of the event is used where the image is used.