Reputation: 1
I was trying to save a contact as vcf with all the required information, but the photo is not displayed. here is my code snippet:
<script type="text/javascript">
// With helper methods
var fooBar = vCard.create(vCard.Version.FOUR);
fooBar.addFormattedname("Mr Foo Bar");
fooBar.addEmail("[email protected]", vCard.Type.HOME);
fooBar.addAddress("street", "code", "city", "country", vCard.Type.HOME);
fooBar.addName("Example One");
fooBar.addPhoto("Programming-Quotes.jpg");
fooBar.addLogo("Programming-Quotes.jpg");
var link = vCard.export(fooBar, "Foo Bar", false);
document.body.appendChild(link);
The addPhoto and addLogo are not working. what should I do?
Upvotes: 0
Views: 925
Reputation: 123
Could you include those helper methods to your code example?
As for my experience with manual VCF files coding and including images inside the best solution was to encode an image with base64 so it worked perfectly on Android and iPhone. When I tried to use a link to an external image somewhere on the internet, the image didn't work.
I also suggest you to make sure you really need the version 4 and not the previous one. I guess more devices support the 3.0 version so I use it.
If you familiar with Javascript you can look closely to those helper methods and make sure they work as it was intended. I had a bad experience with one VCF file generator: it was creating poor and outdated markup so it worked bad and unstable across platforms so I researched the syntax and different VCF versions deep inside and started to code contact files manually since it's not so hard.
Upvotes: 0