* Media order when gedcom imported
Media order when gedcom imported
Hi All,
I have an issue with persons' primary photo (photo order) after importing a tree from a gedcom file.
As you can see in the attached screenshot, the person has 5 photos, and the primary is the marked one with _PRIM.
This photo is on the fifth place in the person's photo list in FH and it displays the first photo as primary for the record.
Is there any trick, query or plugin that I can run to "fix" the photo order meaning putting the photo marked with _PRIM to the top of the photo list as primary photo.
Thanks,
Peter
I have an issue with persons' primary photo (photo order) after importing a tree from a gedcom file.
As you can see in the attached screenshot, the person has 5 photos, and the primary is the marked one with _PRIM.
This photo is on the fifth place in the person's photo list in FH and it displays the first photo as primary for the record.
Is there any trick, query or plugin that I can run to "fix" the photo order meaning putting the photo marked with _PRIM to the top of the photo list as primary photo.
Thanks,
Peter
- Attachments
-
- screehsot of person's media
- screenshot.png (33.6 KiB) Viewed 6321 times
- LornaCraig
- Megastar
- Posts: 3201
- Joined: 11 Jan 2005 17:36
- Family Historian: V7
- Location: Oxfordshire, UK
Re: Media order when gedcom imported
Select the primary picture and then click the black upward arrow in the main toolbar to move it to the top of the list.
Alternatively, go to the Media tab of the individual's Property Box and use the arrows in the toolbar in the centre of that tab to change the order of the pictures.
Alternatively, go to the Media tab of the individual's Property Box and use the arrows in the toolbar in the centre of that tab to change the order of the pictures.
Lorna
- Jane
- Site Admin
- Posts: 8514
- Joined: 01 Nov 2002 15:00
- Family Historian: V7
- Location: Somerset, England
- Contact:
Re: Media order when gedcom imported
_PRIM is a UDF field, but you could write a plugin to move the one with the _PRIM udf field to the top of the list.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
- tatewise
- Megastar
- Posts: 28414
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Media order when gedcom imported
If it only affects a few Individuals then use Lorna's manual method.
It is only worth writing a Plugin if there are a great many.
The _PRIM UDF tag is used by several products, but is NOT standard GEDCOM, so not recognised by FH.
It should be deleted from your FH Project as explained in how_to:handling_unrecognised_data_fields|> Handling Uncategorised Data Fields (UDF).
It is only worth writing a Plugin if there are a great many.
The _PRIM UDF tag is used by several products, but is NOT standard GEDCOM, so not recognised by FH.
It should be deleted from your FH Project as explained in how_to:handling_unrecognised_data_fields|> Handling Uncategorised Data Fields (UDF).
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Media order when gedcom imported
Thank you all for the reply. I have relatively big tree so I try to make some coding to have the expected result.
Could you please suggest some already existing plugins that do similar so that I don't need to start it from scratch?
Could you please suggest some already existing plugins that do similar so that I don't need to start it from scratch?
Re: Media order when gedcom imported
Ok, I started to work on it, but I need some help.
I try to find the right pointer to the list of assigned photo's list but I am not sure what would be the correct way:
I tried several path, finally I managed to find this one which returned something apparently right data:
ptrMedia = fhGetItemPtr(pi,'INDI.OBJE')
In this variable I can see the path of my photos if I index it (OBJE[x]), but I cannot get any other property of them, I am not sure this is the correct path.
Also, I tried to overwrite the data like this:
ptrMedia1 = fhGetItemPtr(pi,'INDI.OBJE[1]')
ptrMedia2 = fhGetItemPtr(pi,'INDI.OBJE[2]')
ptrMedia2 = ptrMedia1
Nothing happened, the photos assigned to the person didn't change at all, everything remained unchanged.
I try to find the right pointer to the list of assigned photo's list but I am not sure what would be the correct way:
I tried several path, finally I managed to find this one which returned something apparently right data:
ptrMedia = fhGetItemPtr(pi,'INDI.OBJE')
In this variable I can see the path of my photos if I index it (OBJE[x]), but I cannot get any other property of them, I am not sure this is the correct path.
Also, I tried to overwrite the data like this:
ptrMedia1 = fhGetItemPtr(pi,'INDI.OBJE[1]')
ptrMedia2 = fhGetItemPtr(pi,'INDI.OBJE[2]')
ptrMedia2 = ptrMedia1
Nothing happened, the photos assigned to the person didn't change at all, everything remained unchanged.
- Jane
- Site Admin
- Posts: 8514
- Joined: 01 Nov 2002 15:00
- Family Historian: V7
- Location: Somerset, England
- Contact:
Re: Media order when gedcom imported
I'll give you a couple of pointers.
To identify the item with the _PRIM tag once you have the obje item use a new pointer to check for the existence of the flag
I would loop through the objects catch the first one to a pointer and then when you find the one with the marker move it above the first one.
eg
ptrObjFirst = fhGetItemPtr(pi,'~.OBJE[1]')
ptrObj = fhGetItemPtr(pi,'~.OBJE')
ptrPrim = fhGetItemPtr(ptrObj,'~._PRIM')
To move the Obj above the first one use
bOK = fhMoveItemBefore(ptrObj,ptrObjFirst)
To identify the item with the _PRIM tag once you have the obje item use a new pointer to check for the existence of the flag
I would loop through the objects catch the first one to a pointer and then when you find the one with the marker move it above the first one.
eg
ptrObjFirst = fhGetItemPtr(pi,'~.OBJE[1]')
ptrObj = fhGetItemPtr(pi,'~.OBJE')
ptrPrim = fhGetItemPtr(ptrObj,'~._PRIM')
To move the Obj above the first one use
bOK = fhMoveItemBefore(ptrObj,ptrObjFirst)
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
- Jane
- Site Admin
- Posts: 8514
- Joined: 01 Nov 2002 15:00
- Family Historian: V7
- Location: Somerset, England
- Contact:
Re: Media order when gedcom imported
P.S If you have not already check out the plugins:index#developer_guide|> Developer Guide on the Knowledge base
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
- tatewise
- Megastar
- Posts: 28414
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Media order when gedcom imported
To loop through media use:
Code: Select all
local ptrObjFirst = fhGetItemPtr(pi,'~.OBJE[1]') -- Get first Media object
local ptrObje = fhNewItemPtr()
ptrObje:MoveTo(ptrObjFirst)
while ptrObje:IsNotNull() do -- Loop through all Media objects
local ptrPrim = fhGetItemPtr(ptrObj,'~._PRIM')
if ptrPrim:IsNotNull() do -- if _PRIM tag exists move this Media object before first
local bOK = fhMoveItemBefore(ptrObj,ptrObjFirst)
local bOK = fhDeleteItem(ptrPrim) -- Delete _PRIM UDF tag
break -- Job done so escape from loop
end
ptrObje:MoveNext()
end
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Media order when gedcom imported
Hi Mike, Jane,
I managed to create what I wanted to do, many thanks for the help, it works fine.
Regards,
Peter
I managed to create what I wanted to do, many thanks for the help, it works fine.
Regards,
Peter