[Vobject] vcard photo

Jeffrey Harris jeffrey at osafoundation.org
Fri May 30 17:01:31 CDT 2008


Hi Patrick,

I think you need to subscribe to the vobject mailing list, your emails 
are getting discarded because you're sending from an address that isn't 
subscribed.

 > Thanks that helped a lot.
> 
> I stumbled on an other problem. I need to save a picture in the vcard 
> photo tag. If i do that i get a ascii encode error. How do i got about 
> this? I found nothing in the docus.

The short answer is that if you're creating vcard 3.0 streams from 
scratch you need to add the encoding=b parameter, here's an example of 
how to do that:

card.photo.encoding_param = 'b'

You also need to add the type parameter (for instance, jpeg).

Note that for vcard 2.1, the base64 string is 'base64', but I haven't 
written the 2.1 behavior, so this won't actually work right now.  If 
you're serializing, you should just use vcard 3.0 if at all possible.

Like a lot of vcard details, so far, the PHOTO behavior isn't very 
smart. Handling the case of value=uri and the default case of binary 
encoding (including determining the type of image) would be great, but 
nobody's gotten around to it yet.

I haven't really used vobject for vcards much, so this isn't really on 
my list of priorities (that's also why the documentation is shallow 
regarding vcards).  But patches would be very welcome!

Sincerely,
Jeffrey


More information about the VObject mailing list