Code Monkey home page Code Monkey logo

google-photos-api's Introduction

Google-Photos-API

Inspired by oc-GooglePhotos-plugin and developed by AWStudio

Description

This library provides an interface to access to google photos using Picasa API. The Picasa API is deprecated, you should only use this client if you want to get Album information, if you don't care about it, you should use the Google Drive API to get the photos.

Instalation

You can use composer to install it:

composer require awstudio/google-photos-api

Usage

To use the client you will need a Google Access Token. Check it here to know how to get it.

<?php

use GooglePhotosApi\Client\GooglePhotosClient;  
  
[...] 
  

$googlePhotosClient = new GooglePhotosClient($settings);
$googlePhotosClient->setGoogleAccessToken($googleAccessToken);
  
$albums = $googlePhotosClient->getAlbumsList();
  
$photos = [];  
  
foreach ($albums as $album){
    $albumId = $album->getAlbumId();
    $photos[$albumId] = $googlePhotosClient->getAlbumImages($albumId);
}

Settings

You can adjust some settings of the client either using the constructor or with the method setSettings. The settings are an array that has as key the value that you want to override and as value the modification.

Setting Type Default Description
kind String (album / photo / comment / tag / user) album
visibility String (all / private / public / visible) all
thumb_size int 200 Size of the thumbnails that will be generated
crop_mode String (h / w / s) s
should_crop bool false
max-results int null Max results to show by petition.
start-index int null Combine with max-result to apply pagination
ignored_albums array [] albums that want to be ignored, by title or ID
ignore_videos bool true Set to false to get the videos on the response.
ignore_image_types array [] Set the images types that want to be ignored f.i : ['image/gif', 'image/jpg']

For more info check Picasa API

Google Access Token

We don't provide a way to get the Google Access Token. Please check the official documentation for that or use a third party library that provides OAuth2 authentification. Right now we use HWIOAuthBundle for our Symfony projects. The scope of the OAuth that you need to set for this client is https://picasaweb.google.com/data/

google-photos-api's People

Contributors

aws-paris avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

nprabhakar

google-photos-api's Issues

Long album ID

When album id is too long like 1000000455940756 the line:
$album->setAlbumId((int) $albumElement->id);

must be replace by :
$album->setAlbumId((string) $albumElement->id);

in album model.

Otherwise all ids will be 2147483647

How to get the googleaccesstoken?

Hi

I want to use your package for one project where i need to fetch the all images for the specific album. Can you please add some notes in readme how to access it with some code sample?

I tried with google developer console and generated api key but it did not work. Can you please let me know how can we access it?

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.