Skip to content

Commit

Permalink
new vision client (#565)
Browse files Browse the repository at this point in the history
* new client and samples

* remove .ds_store

* remove .ds_store

* fix tags

* update tests and README

* add lock file

* fix syntax issues

* fix variable name

* typo

* fix test

* add web-geo test

* fix repeated test

* undo .gitignore change

* troubleshooting
  • Loading branch information
sirtorry authored and ryanmats committed Mar 7, 2018
1 parent a1924aa commit b2959ad
Show file tree
Hide file tree
Showing 30 changed files with 1,100 additions and 821 deletions.
52 changes: 40 additions & 12 deletions vision/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,49 @@ Vision API from PHP.
5. For a basic demonstration of the Cloud Vision API, run `php quickstart.php`.
6. Run `php vision.php`. The following commands are available:
```
face Detect faces in an image using Google Cloud Vision API
help Displays help for a command
label Detect labels in an image using Google Cloud Vision API
landmark Detect landmarks in an image using Google Cloud Vision API
list Lists commands
logo Detect logos in an image using Google Cloud Vision API
property Detect image proerties in an image using Google Cloud Vision API
safe-search Detect adult content in an image using Google Cloud Vision API
text Detect text in an image using Google Cloud Vision API
crop-hints Detect crop hints in an image using Google Cloud Vision API
document-text Detect document text in an image using Google Cloud Vision API
web Detect web entities in an image using Google Cloud Vision API
face Detect faces in an image using Google Cloud Vision API
help Displays help for a command
label Detect labels in an image using Google Cloud Vision API
landmark Detect landmarks in an image using Google Cloud Vision API
list Lists commands
logo Detect logos in an image using Google Cloud Vision API
property Detect image proerties in an image using Google Cloud Vision API
safe-search Detect adult content in an image using Google Cloud Vision API
text Detect text in an image using Google Cloud Vision API
crop-hints Detect crop hints in an image using Google Cloud Vision API
document-text Detect document text in an image using Google Cloud Vision API
web Detect web entities in an image using Google Cloud Vision API
web-geo Detect web entities in an image with geo metadata using
Google Cloud Vision API
```
7. Run `php vision.php COMMAND --help` to print information about the usage of each command.

## The client library

This sample uses the [Google Cloud Client Library for PHP][google-cloud-php].
You can read the documentation for more details on API usage and use GitHub
to [browse the source][google-cloud-php-source] and [report issues][google-cloud-php-issues].

## Troubleshooting

If you get the following error, set the environment variable `GCLOUD_PROJECT` to your project ID:

```
[Google\Cloud\Core\Exception\GoogleException]
No project ID was provided, and we were unable to detect a default project ID.
```

If you have not set a timezone you may get an error from php. This can be resolved by:

1. Finding where the php.ini is stored by running `php -i | grep 'Configuration File'`
1. Finding out your timezone from the list on this page: http://php.net/manual/en/timezones.php
1. Editing the php.ini file (or creating one if it doesn't exist)
1. Adding the timezone to the php.ini file e.g., adding the following line: `date.timezone = "America/Los_Angeles"`

[google-cloud-php]: https://googlecloudplatform.github.io/google-cloud-php
[google-cloud-php-source]: https://github.com/GoogleCloudPlatform/google-cloud-php
[google-cloud-php-issues]: https://github.com/GoogleCloudPlatform/google-cloud-php/issues

## Contributing changes

* See [CONTRIBUTING.md](../../CONTRIBUTING.md)
Expand Down
8 changes: 5 additions & 3 deletions vision/composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "google/translate-sample",
"name": "google/vision",
"type": "project",
"require": {
"google/cloud-vision": "^0.9",
"google/cloud-vision": "^0.10",
"google/cloud-storage": "^1.3",
"symfony/console": "^3.1"
},
Expand Down Expand Up @@ -30,7 +30,9 @@
"src/detect_document_text.php",
"src/detect_document_text_gcs.php",
"src/detect_web.php",
"src/detect_web_gcs.php"
"src/detect_web_gcs.php",
"src/detect_web_with_geo_metadata.php",
"src/detect_web_with_geo_metadata_gcs.php"
]
},
"require-dev": {
Expand Down
Loading

0 comments on commit b2959ad

Please sign in to comment.