0

I want to fetch all the photos on Google photos on my web site using php. Is it possible?. I know Picasa Web Albums Data API deprecated. I have got try it from Picasa. but i am not able to download library from https://developers.google.com/gdata/articles/php_client_lib.

Chandan Kushwah
  • 111
  • 1
  • 2
  • 7

3 Answers3

0

There is currently no Google Photos API. The only thing available is Picasa. You may be able to upload the pictures to your google drive account and display them on your website that way. However your probably going to have to set the pictures to public.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
0

There is an API now for Google photo's. But I've not been successfull in making it work myself

https://developers.google.com/photos/

Vinobe
  • 73
  • 1
  • 11
0

I am trying to do the same thing, so far, I setup the api:

  1. From Google Console API --> enabled the photos library api.
  2. Following this example : https://github.com/google/google-api-php-client/blob/master/examples/simple-query.php I managed to setup the api with the following code :
    include_once __DIR__ . '/vendor/autoload.php';
    include_once 'base.php';
    # create client
    $client = new Google_Client();
    $client -> setApplicationName("Client_Library_examples");

    if(!$apiKey = getApiKey()) {
        echo missingApiKeyWarning();
    }

    $client -> setDeveloperKey($apiKey);

The autoload and base.php files were copied from the mentioned link. I copied my api to a file .apiKey. Up to this point, the code works fine, the example in the previous link explains how to create a new google service for e-books. There must be a similar thing for google photos but couldn't find any yet.

I found the following but I am not getting anything with the echo :

$response = file_get_contents('https://photoslibrary.googleapis.com/v1/albums');
$response = json_decode($response);
echo $response
John Conde
  • 217,595
  • 99
  • 455
  • 496
mtleis
  • 712
  • 1
  • 9
  • 28