Sha256: 649be03f4e1eeb6af3c247eb05a0d77650c951233874f4f499bad8280cfcd9a2

Contents?: true

Size: 462 Bytes

Versions: 24

Compression:

Stored size: 462 Bytes

Contents

#!/usr/bin/ruby -w

require 'vpim/vcard'

vcf = open(ARGV[0] || 'data/vcf/Sam Roberts.vcf')

card = Vpim::Vcard.decode(vcf).first

card.photos.each_with_index do |photo, i|
  file = "_photo_#{i}."

  if photo.format
    file += photo.format.gsub('/', '_')
  else
    # You are your own if PHOTO doesn't include a format. AddressBook.app
    # exports TIFF, for example, but doesn't specify that.
    file += 'tiff'
  end

  open(file, 'w').write photo.to_s
end

Version data entries

24 entries across 24 versions & 11 rubygems

Version Path
vpim-24.2.20 samples/ex_get_vcard_photo.rb
fraser-vpim-0.658 samples/ex_get_vcard_photo.rb
fraser-vpim-0.659 samples/ex_get_vcard_photo.rb
fraser-vpim-rails-0.658 samples/ex_get_vcard_photo.rb
fraser-vpim-rails-0.659 samples/ex_get_vcard_photo.rb
xing-vpim-0.658.1 samples/ex_get_vcard_photo.rb
vpim-13.11.11 samples/ex_get_vcard_photo.rb
vpim2-0.0.1 samples/ex_get_vcard_photo.rb
vpim-rails-reinteractive-0.7 samples/ex_get_vcard_photo.rb
vpim-rails-0.665 samples/ex_get_vcard_photo.rb
thoughtafter-vpim-0.7.0.1 samples/ex_get_vcard_photo.rb
vpim-rails-0.664 samples/ex_get_vcard_photo.rb
vpim-rails-0.663 samples/ex_get_vcard_photo.rb
vpim-rails-0.662 samples/ex_get_vcard_photo.rb
scashin133-vpim-9.4.0 samples/ex_get_vcard_photo.rb
vpim-rails-0.661 samples/ex_get_vcard_photo.rb
mumboe-vpim-0.7 samples/ex_get_vcard_photo.rb
mumboe-vpim-0.695 samples/ex_get_vcard_photo.rb
fairtilizer-vpim-0.695 samples/ex_get_vcard_photo.rb
vpim-0.658 samples/ex_get_vcard_photo.rb