Is there a way to compare two contact photos via google apps script?

252 Views Asked by At

Right now I am running a script on a google sheet to sync contacts between two accounts.

When I am updating I am comparing current vs past data. The contact photos themselves are the same most of the time, with few changes, so I don't want to have to update hundreds of photos each time, which takes a while. Unfortunately I have been unable to find a way to effectively compare the previous photo to the current one.

Each time a contact has a photo uploaded to it you need to give it encoded data, which then google creates it at a given url. The urls for identical photos are different, and when comparing length etc of identical photos from two URLS the photo data doesn't match up. How can I tell if two photos are identical given two photo urls?

Example urls:

https://lh3.googleusercontent.com/-0oH1FBrea-M/YIHHfTH0ICI/AAAAAAAAAAA/YrYmrA92lLoyOf-eTNu8geyomhaEHGEsACOQCEAE/s100/photo.jpg

https://lh3.googleusercontent.com/-G7JfH_vmY3I/YJ2RRLUp0VI/AAAAAAAAAAA/XMDZ_LNXi709ofwRMmI9uLgUOZU7bMVmQCOQCEAE/s100/photo.jpg

Solution: What I ended up doing is storing the first contacts photo_url in the miscKeywords property on the Person object, since I wasn't using anything tied to that. When I went to update my contacts I pulled all the contacts that should match, and then compared the miscKeywords section to see if the url has updated or not.

0

There are 0 best solutions below