Membership vCards with Photos

Discussions around miscellaneous technologies and projects for the general membership.
User avatar
mkmurray
Senior Member
Posts: 3266
Joined: Tue Jan 23, 2007 9:56 pm
Location: Utah
Contact:

Membership vCards with Photos

#1

Post by mkmurray »

My plea still stands for the developers to include a checkbox or something for adding photos into the vCard export that is now available:

http://tech.lds.org/forum/showthread.ph ... #post17698

In the meantime...

I've started writing a little .NET application that will be able to authenticate with LUWS using user-entered credentials and scrape the photos off of the user's local unit Membership Directory. Then the application will put the binary photo data in the appropriate vCards.

The next step (for Outlook users) is to split the one vCard file into separate files. I wrote a little piece of code in about 10 minutes that does this, which I may or may not include the above application's functionality. However, I found a blog post where a user wrote some very helpful VBScripts, one of which does this. I will discuss point you to this in the next paragraph.

So there is one problem with importing these vCards with embedded photos into Outlook (or Windows Contacts, as found in Vista if you don't have Outlook): this problem is that every test I have run as failed to import the picture in the vCard into Outlook. Apparently Outlook doesn't look for the "PHOTO" property or something. So I found the following blog post where somebody created a fix that I am going to try out:

*EDIT: I found out this only works for getting vCards with Photos into Exchange Server (more of an enterprise use than a personal, home use). Read the next post for more info.*

http://gsexdev.blogspot.com/2005/09/imp ... es-to.html

He gives a zip file to download with VBScripts in them which I have attached to this post (one of these scripts can do the vCard splitting from one .vcf file to separate .vcf files). In his blog post, he explains how to configure and use the scripts on your computer.

I will keep this thread posted on how my application is going and my quest to get the Ward Photos on my phone (and hopefully your phone/PDA).

[Attachment Removed; read next post to find out why]
User avatar
mkmurray
Senior Member
Posts: 3266
Joined: Tue Jan 23, 2007 9:56 pm
Location: Utah
Contact:

#2

Post by mkmurray »

mkmurray wrote:...

So there is one problem with importing these vCards with embedded photos into Outlook (or Windows Contacts, as found in Vista if you don't have Outlook): this problem is that every test I have run as failed to import the picture in the vCard into Outlook. Apparently Outlook doesn't look for the "PHOTO" property or something. So I found the following blog post where somebody created a fix that I am going to try out:

http://gsexdev.blogspot.com/2005/09/imp ... es-to.html

He gives a zip file to download with VBScripts in them which I have attached to this post (one of these scripts can do the vCard splitting from one .vcf file to separate .vcf files). In his blog post, he explains how to configure and use the scripts on your computer.

...

Unfortunately, this VBScript to import vCards with embedded photos only works for Exchange Server, not the local desktop Outlook client. It puts the contacts on the global Exchange Server contacts.

I am forced to find another way to get these into Outlook. I suppose I could learn the .contact file format, as I have looked at it when it has an image embedded in it. Perhaps I could write something to auto-import all vCards into Outlook and then go back and attach photos after they are in. This will be tough to do in code, but I think I'm gonna give it a shot.

Again, I'll keep you posted.
User avatar
johnshaw
Senior Member
Posts: 2273
Joined: Fri Jan 19, 2007 1:55 pm
Location: Syracuse, UT

#3

Post by johnshaw »

As I investigated this for my own purposes I found that the windows mail client (used to be called outlook express) did support the vcard format fully and the contacts imported just fine with the one file. you could then use Outlook to pull in the contacts from the mail client. I'm not a big fan of having to do this multiple times, and I've made my bread and butter on Microsoft, but the Outlook vcard issue is ridiculous.
User avatar
mkmurray
Senior Member
Posts: 3266
Joined: Tue Jan 23, 2007 9:56 pm
Location: Utah
Contact:

#4

Post by mkmurray »

jshawut wrote:As I investigated this for my own purposes I found that the windows mail client (used to be called outlook express) did support the vcard format fully and the contacts imported just fine with the one file. you could then use Outlook to pull in the contacts from the mail client. I'm not a big fan of having to do this multiple times, and I've made my bread and butter on Microsoft, but the Outlook vcard issue is ridiculous.
Thank you, I didn't try the multiple vCards in one file thing with the Windows Mail client, I only tried it with the latest Outlook and figured they would use the same algorithm. However, I did import one vCard into Windows Mail (just to get it into Windows Contacts) and the embedded image did not come through with it.
User avatar
mkmurray
Senior Member
Posts: 3266
Joined: Tue Jan 23, 2007 9:56 pm
Location: Utah
Contact:

#5

Post by mkmurray »

mkmurray wrote:I will keep this thread posted on how my application is going and my quest to get the Ward Photos on my phone (and hopefully your phone/PDA).
My efforts are going up in flames quickly. This is not an easy task. The more I tread into pretty sloppy parsing based on the hope that the Church won't change the HTML structure, the more uncomfortable this is becoming.

Let me explain what I have found, as this may be interesting to the Church developers over LUWS...

With my application, I have written a series of code that logs into your Ward Website and begins scraping off the info of each member in the ward with their accompanying family photo. My application also downloads your ward's vCard export from the LUWS site.

Now in order to match up photos with the family vCard, I have to find a piece or set of data to join on. Unfortunately, the vCard entries all have UID properties that seem to come out of thin air. That would be the best piece of data to join on, whatever it is. However, it is not found anywhere in the HTML source of your ward's Membership Directory in LUWS.

So the next best thing to ensure you have the right vCard is to check every other piece of data (names, address, phone, email). This is definitely the hard way and pretty thorough, but it proved possible and so I went forward. However, the vCard export data and the data you can scrape out of the HTML on the LUWS Membership Directory often can differ. Let me enumerate some cases:
  1. The already available LUWS vCard export includes as many Given Names as it can for an individual; the LUWS Membership Directory HTML lists at most 2 Given Names.
  2. The LUWS Membership Directory HTML leaves off all suffixes (Jr., II, etc.); the LUWS vCard export does not leave them off.
  3. The LUWS vCard export enforces a "proper casing" (first letter capital, all other letters lowercase) on all words in a name; this makes names like "McKenzie" and "ten Bosch" appear as "Mckenzie" and "Ten Bosch", respectively. It even formatted the suffix "II" to be "Ii". The LUWS Membership Directory HTML leaves casing as is and applies no such formatting.
  4. The name displayed in both the vCard export and the Membership Directory HTML may possibly have an extra space before or after it; I believe the source of this is that some of the registered members on LUWS typed in their Preferred First Name and left a leading or trailing space in the text field. Unfortunately, the code that puts together the vCard export doesn't trim any leading or trailing spaces like this, but the code I wrote to scrape the Membership Directory HTML does. Thus, a mismatch is occuring. Plus, the vCard properties now have extra spaces in some of the properties, which is actually kind of annoying if your Contacts program or PDA/Cell Phone doesn't parse the extra space out.
I could try to work around these problems, but it just makes this whole thing feel even sloppier. The real solution would be to have the Ward Photos embedded or linked to somehow in the vCard export. I suppose I will list this on the LUWS Suggestion List on the LDS Tech Wiki.

The vCard standard supports either doing this with embedded Base64-encoding binary:

Code: Select all

PHOTO;ENCODING=BASE64;TYPE=JPEG:/9j/4AAQSkZJRgABAQEASABIAAD/2wBD...

...or as a URL:

Code: Select all

PHOTO;VALUE=URL;TYPE=JPEG:[URL]https://secure.lds.org/units...blahblahblah...QwNjA5,00.jpg[/URL]
Pretty please, Church developers? :D

If you can at least connect the photos to the vCards (or even just put the same UID property from the vCards into the Membership Directory HTML, maybe like the "id" of the table containing the family or something), then I could continue and build something to auto import these vCards into Outlook with their photos attached to them.
User avatar
mkmurray
Senior Member
Posts: 3266
Joined: Tue Jan 23, 2007 9:56 pm
Location: Utah
Contact:

#6

Post by mkmurray »

mkmurray wrote:My efforts are going up in flames quickly. This is not an easy task. The more I tread into pretty sloppy parsing based on the hope that the Church won't change the HTML structure, the more uncomfortable this is becoming.
For now, I'm just using the MLS exports, as that gives me the most bang for my buck. I wish I could figure out how to get photos linked with the MLS exports...

Anyway, the method I'm using is Windows Contacts, as I have confirmed that Windows Mail (Outlook Express's successor within Vista) can import a single .vcf file containing multiple vCards. It's terrific the amount of info you get in those MLS exports (HT/VT, birthdays, callings, etc.). Really helpful to my calling of Membership Clerk.
kennethjorgensen
Community Moderators
Posts: 427
Joined: Mon Sep 10, 2007 1:29 am
Location: Alnwick, UK

#7

Post by kennethjorgensen »

mkmurray wrote:My efforts are going up in flames quickly. This is not an easy task.......

If you can at least connect the photos to the vCards (or even just put the same UID property from the vCards into the Membership Directory HTML, maybe like the "id" of the table containing the family or something), then I could continue and build something to auto import these vCards into Outlook with their photos attached to them.
Can I emphasise and support this point too. Having ID's exposed for any records (families, individuals etc) would be a HUGE benefit for those of us who wish to write some added utilities to support the church's existing applications.
User avatar
mkmurray
Senior Member
Posts: 3266
Joined: Tue Jan 23, 2007 9:56 pm
Location: Utah
Contact:

#8

Post by mkmurray »

mkmurray wrote:So there is one problem with importing these vCards with embedded photos into Outlook (or Windows Contacts, as found in Vista if you don't have Outlook): this problem is that every test I have run as failed to import the picture in the vCard into Outlook. Apparently Outlook doesn't look for the "PHOTO" property or something.
So I found out something intersting about Outlook 2007. If I add the embedded photo into the .vcf file and then also change the vCard version number to be 3.0 (instead of 2.1), then the photo will import correctly. However, this only works for Outlook 2007; with 2003, it appears the photo will not correctly import regardless of the vCard version number (I only tried 2.1 and 3.0).

I may pick up this project again and try to solve the problems I named before by doing a "best match" algorithm. It would try to verify all pieces of information about the household and rate the match by percentage or score. If it is 100%, then there is no reason to show this to the user. If there isn't a 100% match, the I would show the user all matches above a certain percentage (like 80% or 90%) and let them tell me which is the correct match.

I personally would like to be able to match up the LUWS photos with the MLS vCards as well (as there is so much more pertinent info for my calling in those vCards), but perhaps that will be a version 2.0 thing or something, as it would only benefit those that can reasonably acquire the MLS exports.

Again, I'll keep everyone posted...
User avatar
mkmurray
Senior Member
Posts: 3266
Joined: Tue Jan 23, 2007 9:56 pm
Location: Utah
Contact:

#9

Post by mkmurray »

mkmurray wrote:I may pick up this project again and try to solve the problems I named before by doing a "best match" algorithm.
I did indeed pick up this project again. I was able to use the Levenshtein Distance algorithm to get a pretty good "best match" algorithm (see http://en.wikipedia.org/wiki/Levenshtein_distance). This algorithm will eventually help with matching MLS vCards to the photos, because there will probably be more discrepancies between MLS data and LUWS data (specifically preferred names and email addresses).

For now though and from what I have found from my preliminary test of a couple wards, the best match of each household between the LUWS html and the LUWS vCards is no less than about 93%. If the match is 100%, there could be a second best match as high as like 80%; but if the first match is 100%, there is no reason to consider a second match. If the match is less than 100% (like 93%), I've almost always seen the second best match be like 45%. In that case, it's pretty safe to assume the top match is it. If the first 2 or 3 matches are pretty high and the top one is not 100%, I have designed a UI that the user can visually see the choices and percentage match, and then make the correct match themself.

Anyway, I need to clean up some of the UI and do some better exception handling. Otherwise, the app can successfully match up the photos to the vCards from LUWS. My current vCard output works perfectly with Mac's AddressBook. I'm working on a way to get it into Outlook 2007, the problem being Outlook won't import more than one vCard at a time. Windows Mail (and it's use of Windows Contacts) can import more than one vCard at a time, but I can't get it to import the photos like Outlook will (if I change the vCard version number to 3.0). Outlook 2007 is then able to import contacts from Windows Contacts. So that is the solution if you want the vCards imported all at once without photos, as has been asked on a few other threads. I'll post that solution to the appropriate threads when I get a chance.

And as I said before, I would like to be able to match up the photos to the MLS vCards. So I've still got quite a bit of work ahead of me. I'll keep ya updated.
User avatar
mkmurray
Senior Member
Posts: 3266
Joined: Tue Jan 23, 2007 9:56 pm
Location: Utah
Contact:

#10

Post by mkmurray »

I just wanted to let people know I made quite a bit of progress on this a while back, but have been so busy the last month or so with Tithing Settlement preparations and deadlines at work.

The project really is somewhat close to an initial release but I need to clean up the code some first. Also I'm trying to figure out how the best way to deploy Office plugins are (I have written a plugin that will import more than one vCard in a single .vcf file; as far as I can tell mine would be the only free version I can find of such a plugin).
Post Reply

Return to “Other Member Technologies”