Git Product home page Git Product logo

php-photoslibrary's People

Contributors

arielmagbanua avatar jfschmakeit avatar laurenmanzo avatar livgorton avatar signpostmarv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-photoslibrary's Issues

Descriptions with unicode characters are ignored in batchCreateMediaItems

Descriptions that contain unicode characters are ignored when calling batchCreateMediaItems(..).

We have verified this by using the string КОНТАКТНЫЙ ТЕЛЕФОН.

This does not appear to be an issue in the API itself, but rather an issue with the encoding of strings when making the request.

server to server connect

thanks for the good examples, I would like to know how to connect to bees without passing from the google windows authorization for example for a server-to-server functionality

pageSize has no effect ?

Sorry for my poor english.

I downloaded sample from this repo, and change line 36 of albums/index.php

from
$pagedResponse = $photosLibraryClient->listAlbums();

to
$pagedResponse = $photosLibraryClient->listAlbums(['pageSize' => '5']);

but i got all 58 albums back.

token expired how to refresh?

i will be the only one using it , on the backend server side meaning 1 user only i tried saved token on a file but how do i refresh because it expires after 1 hour

Can't get next page token from response

Hi,
When making a call to searchMediaItems, the response object does not contain the methods of SearchMediaItemsResponse, only PagedListResponse, therefore I am unable to retrieve the next page token.

$photosLibraryClient = new PhotosLibraryClient(['credentials' => $credentials]);
$response = $photosLibraryClient->searchMediaItems(['pageSize' => 50]);

$response->getNextPageToken() is undefined

Example code fails with error unsupported_grant_type

Trying to run example code from docs but it fails with this error:

PHP Fatal error:  Uncaught GuzzleHttp\Exception\ClientException: Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response:
{
  "error": "unsupported_grant_type",
  "error_description": "Invalid grant_type: "
}
 in /media/G/BFHome/Projects/Web/GooglePhoto/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
Stack trace:
#0 /media/G/BFHome/Projects/Web/GooglePhoto/vendor/guzzlehttp/guzzle/src/Middleware.php(66): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))
#1 /media/G/BFHome/Projects/Web/GooglePhoto/vendor/guzzlehttp/promises/src/Promise.php(203): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#2 /media/G/BFHome/Projects/Web/GooglePhoto/vendor/guzzlehttp/promises/src/Promise.php(156): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array)
#3 /media/G/BFHome/Projects/Web/GooglePhoto/vendor/guzzlehttp/promises/src/TaskQueue.php(47): GuzzleHttp\Promise\Pr in /media/G/BFHome/Projects/Web/GooglePhoto/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 113

Code I've tried to run:

<?php
require('vendor/autoload.php');

use Google\Auth\Credentials\UserRefreshCredentials;
use Google\Photos\Library\V1\PhotosLibraryClient;
use Google\Photos\Library\V1\PhotosLibraryResourceFactory;

$credentials = json_decode(file_get_contents('credentials.json'), true);
$credentials = $credentials['installed'];
$credentials['refresh_token'] = null; // fails with error "Missing required parameter: refresh_token" without setting it

$scopes = array(
    'https://www.googleapis.com/auth/photoslibrary.readonly',
    //'https://www.googleapis.com/auth/photoslibrary',
    'https://www.googleapis.com/auth/photoslibrary.sharing',
    'https://www.googleapis.com/auth/photoslibrary.appendonly',
    'https://www.googleapis.com/auth/photoslibrary.readonly.appcreateddata'
);

$authCredentials = new UserRefreshCredentials(
    /* Add your scope, client secret and refresh token here */
    $scopes,
    $credentials
);

$photosLibraryClient = new PhotosLibraryClient(['credentials' => $authCredentials]);

$newAlbum = PhotosLibraryResourceFactory::album("Example Album");

$createdAlbum = $photosLibraryClient->createAlbum($newAlbum);

$albumId = $createdAlbum->getId();

The error occurs when calling $photosLibraryClient->createAlbum($newAlbum).

Cannot install with PHP 8

When I run composer require google/photos-library I get this error:

google/photos-library dev-main requires php ^5.5 || ^7.0 -> your php version (8.0.5) does not satisfy that requirement.

Is there anything specific that is incompatible with PHP 8, or should the platform requirements be simply changed to >=5.5, which doesn't exclude PHP 8?

Please fix creation_time

When $photosLibraryClient->batchCreateMediaItems($newMediaItems, ['albumId' => $albumId]);

Error:
vendor/google/gax/src/ApiCore/Transport/RestTransport.php:153
Error occurred during parsing: String specified for bool or submessage field: creation_time

InvalidArgumentException with guzzlehttp dependency

Error message is clear:

InvalidArgumentException: Passing in the "body" request option as an array to send a POST request has been deprecated. Please use the "form_params" request option to send a application/x-www-form-urlencoded request, or the "multipart" request option to send a multipart/form-data request. 

Please update library.

EDIT: ok, it is more google/gax issue than this one, but media uploading is broken currently.

Easily access credentials from browser

I am using credentials.json file to access clientid, redirecturl, and so on. is it safe to use from json file, because we can access it from direct url

Json key is missing the refresh token field in google photos api

While authenticate i got this error

Fatal error: Uncaught InvalidArgumentException: json key is missing the refresh_token field in C:\xampp\htdocs\gphotos\vendor\google\auth\src\Credentials\UserRefreshCredentials.php:78 Stack trace: #0 C:\xampp\htdocs\gphotos\config.php(49): Google\Auth\Credentials\UserRefreshCredentials->__construct(Array, Array) #1 C:\xampp\htdocs\gphotos\index.php(5): connectWithGooglePhotos() #2 {main} thrown in C:\xampp\htdocs\gphotos\vendor\google\auth\src\Credentials\UserRefreshCredentials.php on line 78

common/common.php uses League/Plates/Engine

I am trying to play with this example but am running into the problem that it apparently uses a template from League/Plates/Engine, without 'require'-ing any script. I tried adding

'use League/Plate/Engine'

to common/common.php, hoping that the server that I am working on had the templates installed, but this does not help.

I am a bit new to standalone php development, so far have been working on a Joomla! website, which had a lot of the boiler plate stuff taken care of.

Do you have any suggestion how to get going with the samples without the League templates and/or how to get a minimal version of it downloaded?

Thanks, Marco.

Fatal Error when calling methods on in PhotosLibraryClient class

I am getting the error below when calling any method on a PhotosLibraryClient object. I read on stackoverflow that this could be due to a missing bcmath extension but enabling this (via composer) did not help.

Fatal error: Uncaught Error: Call to undefined function Google\Protobuf\Internal\bccomp() in /app/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php:933 Stack trace: #0 /app/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(1218): Google\Protobuf\Internal\Message->convertJsonValueToProtoValue('1242', Object(Google\Protobuf\Internal\FieldDescriptor)) #1 /app/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(1167): Google\Protobuf\Internal\Message->mergeFromArrayJsonImpl(Array) #2 /app/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(815): Google\Protobuf\Internal\Message->mergeFromJsonArray(Array) #3 /app/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(1218): Google\Protobuf\Internal\Message->convertJsonValueToProtoValue(Array, Object(Google\Protobuf\Internal\FieldDescriptor)) #4 /app/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php(1167): Google\Protobuf\Internal\Message->mergeFromArrayJsonImpl(Array) #5 /app/vendor/google/protobuf/src/ in /app/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php on line 933

README issues

There is a dead link to samples on the README page (under review the samples), and the sample itself is missing some key components, such as php syntax in the code blocks, a use statement for the PhotosLibraryClient class, and an explanation for $_SESSION['credentials'].

I would submit a PR but my understanding is all of this is automatically generated. Or are the READMEs maintained separately? If so I can submit some fixes.

Tests Failed on PHP Version 5.5

One of the test of current main branch code is failing on PHP version 5.5.

image

I bet originally the method was setExpectedException from phpunit 4.8.36. It is likely somebody refactored it to expectException since he/she might be working on new PHP version (perhaps 7.0?) which implies newer version of phpunit which setExpectedException is definitely deprecated.

Should we stop supporting PHP version 5.5 and support newer PHP version and then replace those deprecated methods?

Token has been expired or revoked

Although I use the parameter "access_type = offline" the token expires and I can not work offline for more than 1 hour.
The error message is:
{
"error": "invalid_grant",
"error_description": "Token has been expired or revoked."
}

And the code is
$authCredentials = new UserRefreshCredentials( [ 'https://www.googleapis.com/auth/photoslibrary.sharing', 'https://www.googleapis.com/auth/photoslibrary' ], [ 'client_id' => $this->client_id, 'refresh_token' => $this->refreshToken, 'client_secret' => $this->clientSecret, ] );
How can I renew the token without user intervention?

Error Uploading File

Type: Error

Message: Call to undefined method Google\Photos\Library\V1\NewMediaItem::setFileName()

Filename: ..vendor/google/photos-library/src/Google/Photos/Library/V1/PhotosLibraryResourceFactory.php

Line Number: 100

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.