See example 3 there. You add a Hash (SHA-1) of your photo to your presence. When you receive a presence with a Hash you check if you have the Image for this Hash. And only if you don't have it you request the vcard and store the image in your local storage.
I usually use the hash as the filename for the images.