I'm trying to import a photo into my card using vobject. I have the image stored inside my static folder and the filename inside my database. I would like to import it in my VCard.
So far I have made this:
if request.method == "POST":
rowr = User.query.filter_by(user_id = user_id).first()
rowes = Profile.query.filter_by(user_id = user_id).first()
vcf_file_path = 'static/Contacto.vcf'
with open(vcf_file_path , 'w') as file_vcard:
vcard = vobject.vCard()
o = vcard.add('fn')
o.value = rowes.pname
if rowr.img_url != 'default.png':
o = vcard.add('PHOTO')
o.value = rowr.img_url
if rowes.pemail != None:
o = vcard.add('email')
o.type_param = 'INTERNET'
o.value = rowes.pemail
if rowes.pcellphone != None:
o = vcard.add('TEL')
o.type_param = 'Número Celular'
o.value = str(rowes.pcellphone)
if rowes.webpage != None:
o = vcard.add('url')
o.type_param = "Página Web"
o.value = rowes.webpage
if rowes.textarea != None:
o = vcard.add('note')
o.type_param = "note"
o.value = rowes.textarea
file_vcard.write(vcard.serialize())
But it's clearly no displaying the image in my VCard. I've tried writing the entire path but also didn't work. Thanks in advance