I am going through the authentication process by using the javascript api. I can successfully retrieve contact entries. From these contact entries I am querying for the photo's image address with ...getContactEditPhotLink().getHref(). I seemingly successfully retrieve an address. I then insert the image tag dynamically using innerHTML. The image doesn't load, but if I change the address to another known image, it loads that image.
I don't see how the second document specifically refers to or interacts with the javascript client contacts library. Do I need to perform a GET on the link that was retrieved using the javascript contacts library? That seems like a strange thing for the javascript API not to provide since it doesn't readily reveal the authentication token or a function to get the image itself. Also, the javascript API wraps all the AJAX/xmlHttpRequest, so I would have to make my own AJAX/ xmlHttpRequest call just to load the image while using the API for everything else? I have a version I am playing with on the web at http://www.gmap-friends.com/dev/index.html . After logging in, press the show/hide contacts link above the ads. Any contact that has a google image pop up next to it should have a contact photo load next to it. The google image is dynamically inserted using innerHTML just as I was hoping to do with the contact photos. My code hasn't changed, see first post. Thanks On May 6, 6:34 am, "Julian (Google)" <[email protected]> wrote: > Hi Aaron, > > You need to authenticate to be able to use the > API:http://code.google.com/apis/contacts/docs/1.0/developers_guide_js.htm... > > Also, here is the information about retrieving a > photo:http://code.google.com/apis/contacts/docs/1.0/developers_guide_protoc... > > Cheers, > Julian. > > On May 6, 7:14 am, Aaron <[email protected]> wrote: > > > Hi, > > > Working on my first javascript/ajax project and I am stumped by the > > following question and have failed to turn up anything by searching. > > > The following code works as expected, it retrieves what appears to be > > a link of some sort and dynamically inserts it into the desired div. > > However, in Safari, I get the little missing image icon where the > > image should be. (In Firefox, nothing shows up.) I tried this same > > code with a link to an image known to exist, the code inserted > > correctly and the image loaded into the page. So it seems that there > > must be something wrong with the link or I am attempting to use the > > link incorrectly. > > > if (isDefined(this.entry.getContactPhotoLink())) { > > code += '<img src="'+this.entry.getContactEditPhotoLink > > ().getHref()+'"></img> '; > > } > > .... > > document.getElementById(divID).innerHTML = code; > > > The link returned by getContactEditPhotLink().getHref() is > > "http://www.google.com/m8/feeds/photos/media/aarontkennedy%40gmail.com......" > > . If I cut and paste this link directly into the address bar, I get > > the following error: Authorization required > > Error 401 > > > My project is a mashup of using google contacts. I am trying to print > > to the screen the contact photos along with other contact > > information. How do I load this image so that it works correctly? Do > > I need to add it to the DOM correctly and avoid innerHTML? It seems > > that it should work since the other images have loaded. > > > Thanks in advance. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Contacts API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-contacts-api?hl=en -~----------~----~----~----~------~----~------~--~---
