Open akam-it opened 7 years ago
I just hit this today while attempting to programmatically add images to some vcards:
Base64.encode64 won't work as that has line breaks every so often which causes VCardigan to think you're attaching multiple broken images (as it thinks the photo is an array of text). Instead, use Base64.strict_encode64, which works fine.
Example:
photo = Base64.strict_encode64(some_file) vcard.photo photo, {:type => 'jpeg', :'ENCODING' => 'b'}
For anyone else running into issues this worked for me:
encoded_string = Base64.strict_encode64(File.open("icon.gif", "rb").read)
vcard.photo encoded_string, {:type => 'image/gif', :'ENCODING' => 'b'}
Is it possible to attach photo to vcard? I tryed vcard = VCardigan.create vcard.photo File.binread("1.jpg") vcard.photo "TYPE=JPEG;ENCODING=b:" + Base64.encode64(File.binread("1.jpg"))
but unsuccessful