Search code examples
javascriptpicasagoogle-pickergoogle-photos

Retrieve a full sized image from a picasa link


for a website I work with several social network APIs to retrieve picture. Currently my problem is with Google Photo.

I follow this guide to open a google picker with the user picture, but when I click on a picture (inside the Picker), the only link that I have is somethink like https://picasaweb.google.com/userID/albumID#pictureID .

If anyone already face this problem or have a solution...I'm on!


Solution

  • Thanks to @Teyam, I am able to retrieve full sized picture, here is how I do: 1- I retrieve the picture from my album with the google picker (to implement a Google Picker, see this Google Picker example) 2- In the function pickerCallback instead of returning the docs[0].url to the user, I return the docs[0].thumbnails[0].url 3- I replace the /s32-c/ in the previous url with /s0/ for full sized picture.

    Here is my custom getPickerCallback:

    function pickerCallback(data) {
        var url = '';
        if (data[google.picker.Response.ACTION] == google.picker.Action.PICKED) {
            console.log(data);
            var doc = data[google.picker.Response.DOCUMENTS][0];
            var thumbnails = doc[google.picker.Document.THUMBNAILS];
            var url = thumbnails[0].url;
            //now replace the /s32-c/ with /s0/ for full size image
            url = url.replace("/s32-c/","/s0/")
        }
        var message = 'You picked: ' + url;
        document.getElementById('result').innerHTML = message;
    }

    And if you want to resize the picture, you can do it in the url, for instance if you want 1200xsmth pic, you can set /s1200/ in the url.