DanielHabenicht / ngx-vcard

MIT License
15 stars 14 forks source link

photo in vcf-card #377

Open 1102ankit opened 4 years ago

1102ankit commented 4 years ago

Not able to show photo or logo when passing the URL.

Easyschools commented 4 years ago

any updates on this?

neamtuBC commented 3 years ago

I have the same problem

blahblehblah commented 3 years ago

same

blahblehblah commented 3 years ago

i converted it to base64 and it worked, plus changed : into ;

DanielHabenicht commented 3 years ago

@blahblehblah In the source code? Or in the object you gave to the formatter? Would you mind sharing your solution? Than I might make a change, if I have time.

blahblehblah commented 3 years ago

@blahblehblah In the source code? Or in the object you gave to the formatter? Would you mind sharing your solution? Than I might make a change, if I have time.

I gave it a url and handled the conversion of the url to base64 in my backend, however, we can simply inject a canvas incase of a url, load the image and use toDateURL() to get the base64

blahblehblah commented 3 years ago

Or use a filereader perhaps, talking about client side solution for now

fastesol commented 3 years ago

Hi @blahblehblah Can you please share the sample vcf with photo?

Thank you!

iconio commented 2 years ago

@blahblehblah could you share the code. I've been looking into this as well and can't make it work :/ I also tried as base64 and no dice :(

olivierschmid commented 2 years ago

For base64 encoded foto I have to set encryption and type parameter. Could you add them so we could use:

..... photo: { value: contactImageBase64, param: { TYPE: 'image/jpeg', ENCODING: 'b' } },

......

Only working method for now is to use

photo: 'ENCODING=b;TYPE=image/jpeg:' + contactImageBase64

and then replace generated PHOTO:ENCODING... with PHOTO;ENCODING...

Thank you! Oli

SwapsPatil commented 2 years ago

BEGIN:VCARD VERSION:2.1 FN:Swapnil Patil N:Patil;Swapnil;;; ORG:org ADR:;;Office 121 Street 234/A, India TEL;TYPE=voice:1234561111 EMAIL:spatil@demo.com TITLE:Software Engineers PHOTO:PHOTO;TYPE=PNG;ENCODING=B:iVBORw0KGgoAAAANSUhEUgAAASkAAACqCAMAAADGFElyAAABiVBMVEX///9RmeXuuYrm5uY8T1zl5eXk5ORKMStwQjP19fXx8fHs7Oz39/fp6eny8vL8/PzJnXb6xZL2u4P/T21Qm+nUpXz1v47qt4hqOy7ttID0u4VJluVFKSJwQTA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PID/Fp5ECpK0MElXLmagebowscIWNerCSXhxPXly+lFJbdAp90qDGK02ibOucZSldJn7MxUWsoycLyfqvAtFsNazf9vhnxM3muDkE9PBg4qINDr2mj/qRDSganvh80qoOnBYbdo5Oj85BStOPBBqvlY9VdsDQIUmLuQ/ZfDdJTAwxWy2/A97tMS4ID4atYBevZKrpGefAKqbQevEJX9h9X4yglxX4iTU59OqgWeADGxJZpIeyWKHarHruJZ/BITDcMu9ruu+9AUj0OsSLFL8s3jnN4CxFtt2e1fVCZJ6bUtQG41cFTTSdiyQebo+NKpbC1J5bVwd6W5oq6LlIDqAoaVI7uUv52IK4JLh8cw9SIw25BObrQ6sWAPiSpa78KYrUMG56nZhy3e8QqOLjyKbwRwJQ9Pqvlg8OUGvUJjSM3O8w8o/Y0Zje4vHyoxXiW5aCedEit3KdUwDukAivgJan19FJ0VgeX3rckajdPkOK1m79yP/BuENeNE75K37sqsB2b1NbxeaRGuHxwftwy0+Wh2I1vJiUhft7a6yhP+fW/U8c1Utp6vxcS1vLBnulOvjXjFOVo7ZPHkZe4W4imbr3fP+AcPC8vH+y/Rzeh+cWS/xWZJy3qalL2+PANoOWHC2gP3hwea6oWHHWHMTss5B4H30oI1iyhtHX86+ENiIskhl44uHH4qzm249xzU7zdNik0E2qWLMCZUPCvdcc2PHIpwZE1f+xVZuFRsJI8gXWvdz6blVpbR789fXF4/sbi9Ob88MXT346OWgW4dMhlGkuZFWL3fwFauR2smTvGYgAAAABJRU5ErkJggg== URL:www.org.com NOTE:Software Engineer END:VCARD

I have converted a image into base64 but still I am not able view it into mobile contact details. Above mentioned code generated through VCard. Please help me to fix it. Thank you!

jeneg commented 1 year ago

I've checked source code and only way I found to use base64 image and not changing the lib or final generated file would be

photo: {
    value: imgBase64, // only data, without data:image/[...];base64 part, use imgBase64.split(',').pop() to strip out
    param: {
        // @ts-ignore
        type: 'JPEG;ENCODING=b'
    }
}

ts will complain for non declared type, so @ts-ignore used

jeneg commented 1 year ago

BEGIN:VCARD VERSION:2.1 FN:Swapnil Patil N:Patil;Swapnil;;; ORG:org ADR:;;Office 121 Street 234/A, India TEL;TYPE=voice:1234561111 EMAIL:spatil@demo.com TITLE:Software Engineers PHOTO:PHOTO;TYPE=PNG;ENCODING=B:iVBORw0KG... URL:www.org.com NOTE:Software Engineer END:VCARD

I have converted a image into base64 but still I am not able view it into mobile contact details. Above mentioned code generated through VCard. Please help me to fix it. Thank you!

You have extra PHOTO: part in PHOTO:PHOTO;TYPE=PNG; line