omg_wtf_lol has asked for the wisdom of the Perl Monks concerning the following question:

I using the above Perl Module from CPAN to loop through each vCard in a .vcf file and saving the results to a database. All of the information is pulled correctly with the exception of the data for the PHOTO node. It seems that it picks the PHOTO node at random rather than the PHOTO node for that specific vCard and I am not sure why. Here is my code:
if($p{'vcard'} =~ m/\.vcf/){ <br/> my $vcard_file = $cgi->upload('vcard'); <br/> my $vcard_list = Text::vCard::Addressbook->new({ 'source_file' => +$vcard_file });<br/> foreach my $vcard ($vcard_list->vcards()){<br/> ...<br/> ...<br/> ...<br/> my $photo = $vcard->get({ 'node_type' => 'photo' }); <br/> my $contact_photo = $photo->[0]->value();<br/> #decodes it with MIME::Base64<br/> #uses Image::Magick to write it as jpg and save to directory<br/ +> ...<br/> ...<br/> ...<br/> }<br/> }<br/>

Replies are listed 'Best First'.
Re: Text::vCard::Addressbook Photo Node
by Your Mother (Archbishop) on Jun 16, 2008 at 17:40 UTC

    Total guess: if everything is working except the images, it's because you're naming the images the same thing or something random over and over. Name the image with the primary key of the database record to which it belongs and check those to see if they match expectations.