hCard Photo’s

We recently soft launched a minor site for friend, with an hCard enhanced contact page and a link to transform the hCard into a vCard using the http://technorati.com/contacts/ web-service. The “client” was over the moon, but asked if it was possible to include their logo on the vCard that was produced. Now I know from the specs that both vCard and hCard support a photo section but getting it to work wasn’t simple.

  1. The http://technorati.com/contacts/ uses an older version of Brian Suda’s X2V which doesn’t seem to support PHOTO:
  2. vCard doesn’t appear to support my favoured image format of PNG

To work around these we implemented our own web service wrapping the latest versions of the X2V transforms – you can read about that here, I then converted the image to BMP (the old timers format of choice!) However I STILL could not get the logo to show in any of the windows clients. Apparently Outlook and Windows Mail, etc. don’t support a URI for the PHOTO:, even though the vCard spec allows this.

In the end I had to use the little known used <img src= “data:image/bmp;base64,xxxxxxxx” /> with a base64 encoded bmp image replacing the xxxxxx to include the actual binary data for the image into the hCard, and thus into the transformed vCard.

The live page can be found here.


2 Responses to “hCard Photo’s”

  1. JamesD Says:
    June 11th, 2009 at 11:55

    Thanks for the useful info. It’s so interesting

  2. Farko Says:
    July 12th, 2009 at 17:16

    Thank you. I am pleased to read your article.

Leave a Reply