Laravel: Google Cloud Storage and Google Compute Engine - laravel

I need to store user data to my google cloud storage bucket.
I'm running laravel on google compute engine.
Could someone assist with this?
I've found only tutorials for google app engine so far.

The Google Cloud Storage JSON API is a simple, JSON-backed interface for accessing and manipulating Google Cloud Storage projects in a programmatic way.
You will need to use Google APIs Client Library for PHP to send requests to the Google Cloud Storage JSON API. See the links below for more info and examples:
https://cloud.google.com/storage/docs/json_api/
https://cloud.google.com/storage/docs/json_api/v1/json-api-php-samples

Related

Google cloud vision API samplesfor ruby

I am using google-cloud-ruby client library, I don't see any samples related to current implementation of google cloud vision API. From where should I look out code samples of google cloud vision API for ruby client library.
It is hosted together with the rest of the google cloud ruby samples here

Can I use Google API without Google Compute Engine? (Cloud SDK)

https://www.youtube.com/watch?v=chk2rRjSn5o
https://www.youtube.com/watch?v=nMY0qDg16y4&t=491s
These series of videos use Google Compute Engine to access Google Cloud vision API.
But, I only want to use Google cloud vision API on my local computer.
I found Cloud SDK is an option but I don't understand how it works.
Does it link my computer to Google Compute Engine?
Then, do I still have to pay for the Engine?
To Sum up the question.
Is there any way that I only pay for Google Cloud Vision API without paying for Google Compute Engine?
TL;DR - Yes you can - they are separate services and you can use them either independently or combine them if needed. You pay only for what you use.
Google Compute Engine
The first youtube video link you shared is for using Google Compute Engine (GCE), which is an IaaS (Infrastructure as a Service) option in Google Cloud. You can use this to set up VMs, custom networks, instance groups, load balancers and other infrastructure.
Google Cloud Vision
Google Cloud Vision is a more specific service which helps you with just Image analysis. It is a service independent of Google Compute Engine and you need not use Google Compute Engine to use the Cloud Vision APIs (although you can do that too if you wish in the future).
In other words - yes, you need not pay for Google Compute Engine to use just the Cloud Vision APIs.
Both Cloud Vision and Google Compute Engine are cloud services part of Google Cloud Platform. Both of them require first creating a project (using Google Cloud Console) and setting up billing before you can use either of those services (or in fact any of the Google Cloud services).
Trying the Cloud Vision API
Here is a quickstart tutorial with detailed steps to try Cloud Vision API directly in the browser.
If you prefer using Cloud SDK and the Cloud client libraries, here is a detailed example with steps.

How to connect Spring MVC application and cloud storage

I do application on Spring MVC where I need to store users photos. There are some ways to store files, but they have disadvantages:
in local storage - limit of host storage
in DB - cashe, limit of DB, long process of converting images to store in DB
I want ask you, is there some way to upload images(any files) on cloud service, for example https://i.onthe.io/ or google drive and then load them to my application (on JSP page).
There will be 2 steps to upload into Google Drive from a Spring application.
1.Implement Oauth2 Authorization - Either by using Google APIs or Spring OAuth2
2.Use Drive API Client Library for Java to upload/download files into Google drive.
Refer GoogleDrive API JavaDoc here.
Spring Cloud AWS maybe can help you enter link description here

Add files from Google Cloud Storage to Drive

I'm developing a backend service in NodeJS. It processes images from Google Cloud Storage by requesting a temporary link and sending this link to a third party analysis service. I'd also want the images to be added to a shared Google Drive folder. Is there any possible way to do this easily (e.g. by using the Drive API and posting the link to the file, instead of downloading the file and subsequently uploading it). In other words: does the Drive API accept links to files, instead of uploading them? Or is there any other clever way of sharing Google Cloud to Drive easily (as it's both Google services).
Thanks
The best way to do this right now would be to use a Google Colab notebook:
Create a Google Colab notebook and connect to your GCP bucket and mount Google Drive to it:
# authenticate
from google.colab import auth
auth.authenticate_user()
# set your gcp project
!gcloud config set project my-project
# mount your drive
from google.colab import drive
drive.mount('/content/drive')
Run a gsutil command to copy your GCP storage data to the mounted drive
!gsutil -q -m cp -r gs://my-bucket-name /content/drive/My\ Drive/
I have done some searching but, I don't see a way to add files from Google Cloud Storage to Google Drive other than doing downloading and uploading them. Also AFAIK, gsutil, which Google Cloud Storage APIs can interact with, also supports downloading and uploading of files when sharing to other storage.
And, as answered in Cloud Storage - Frequently Asked Questions, Google Drive and Google Cloud Storage are two different storage services wherein both allow programmatic access to their functionality, but the goals of the APIs are quite different.
However, you may want to try using Request Endpoints wherein you can access Google Cloud Storage through three request endpoints (URIs). Which one you use depends on the operation you are performing.
IMPORTANT NOTE: The Google Cloud Storage URIs described on this page are subject to change.
You can use the following URLs to access an object:
XML API
storage.googleapis.com/<bucket>/<object>
<bucket>.storage.googleapis.com/<object>
JSON API
www.googleapis.com/download/storage/v1/b/<bucket>/o/<object-encoded-as-URL-path-segment>?alt=media
These URLs support secure sockets layer (SSL) encryption, which means you can use either HTTP or HTTPS. If you authenticate to the Google Cloud Storage API using OAuth 2.0, you should use HTTPS.
You may want to also check Sharing and Collaboration for more information.

Google Cloud Storage to serve website images

We will launching a Google Campaign for our Website and expecting high number of users visiting our website.
Hence, I did some pre-calculations and figured out that serving images from Cloud servers would be best approach, which are currently being served from dedicated server.
I haven't got any clue on how Google Cloud Storage works or any other service. So can someone please guide me to relevant steps that I should be taking for hosting all our images to Google Cloud Storage and how can I serve them from Europe, and mapping of subdomain.
Currently I am following this Guide
Edit:
Before going for Cloud I compared the purpose of CDN vs Cloud and this what I figured out.
CDN: Used for serving contents from multiple regions: Speed is the purpose
Cloud: Used for serving contents for high bandwidth usage: High Availability is the purpose
And my Main purpose is High Availability, I hope I have gained correct information from dear friend Google.
Are you looking for this: https://developers.google.com/storage/docs/bucketnaming
You need verifying your domain name so it can use a CNAME in Google Cloud Storage
https://groups.google.com/forum/#!topic/gs-discussion/V-nLULNRQLI
After second thought, are you sure you need Google Cloud Storage?
It sounds like you just need a CDN or Amazon S3 stuff.
If memory serves, you need to do the following to use Google Cloud Storage with a custom domain:
verify your own domain names, such as example.com
upload images to Google Cloud Storage, you can use tools such as gsutil etc
serve these images with your own subdomain names such as images.example.com etc
You can serve images from google cloud storage. The nice benefit is: Google will do the serving for you and when you use the images api to create serving_url's you can crop and size the images while serving.
Look at this gist for details.
If you like to use you own domain as part of the image url, you cannot use https!
Serving Static Files
Applications often need to serve static files such as JavaScript, images, and CSS in addition to handling dynamic requests. Apps in the flexible environment can serve static files from a Google Cloud option like Cloud Storage.
https://cloud.google.com/appengine/docs/flexible/nodejs/serving-static-files

Resources