I want to upload the photo in google cloud server instead of my server to avoid load on my sever. Also I want to fetch the images later in my server. I will do that in php and mysql. Is it possible to do that? If so then how shall I proceed? Please help me.
You can interact with Google Cloud Storage via its RESTful API or use a php library like tws_service_google_storage.
Related
We have 2 different system that's hosted to 2 different server. Let's call them API and CRM. The system we have on API obviously is all APIs and the CRM is our main system. So we also have this website where we can create a data in our Database.
I'm having trouble in finding a way to put the uploaded file from API to CRM server. The code is $upload->path = $folder.DIRECTORY_SEPARATOR.$date_append.$filename; and it looks like this "path/to/api/[date]-filename"
since $folder = storage_path('uploads');
So how do I make it path/to/CRM/[date]-filename instead of API where it's originally created?
if your API server is public and you don't mind using it as hosting for the image then you can use it in the CRM like this ex: https://apiserverdomain.com/path/to/CRM/[date]-filename.
but the best practice is to use Cloud Storage (like AWS S3 or Google Cloud or even FTP) and display the URL in your CRM from the Cloud Storage directly
I hope it's helpful
Can we upload image files to a GCP running compute engine directly using PHP?
I know that it can be done using the backend ssh on GCP.
I have a solution that works in my local system to upload files but does not work on GCP.
Based on initial research it appears that GCP does not allow file upload directly.
Need confirmation though or if there is a way in which file upload can work, please enlighten.
I do not think it can be done directly through php, through ssh yes.
You can upload files with PHP.
If you want to upload to the server local disk, things become a bit simpler. Just ensure you have PHP configured for upload: PHP File Upload
If you want to upload to Google Storage, say to a bucket, you'd need to authenticate and get access there. Google Cloud SDK can provide this. Then you can install API Client Libraries for PHP and optional Cloud SDK components. That way you might call gcloud shell command or use API. Cloud SDK will provide transparent connection and authentication for you so that you can upload to the Google Storage.
Please see:
Cloud SDK
Google API Client Libraries
I am building an android app where users need to upload & retrieve the images. I need to do that with the Google Cloud Storage. How can I do that if there is a way? I have used PHP as a backend & APIs. I see that they provide APIs for that but there is no way of direct implementation with the PHP. The backend and APIs' code is uploaded on the Google Compute Engine.
You could either upload the image on your frontend and give the url of the image to your BackEnd. Or you could use the GCS JSON API from your php backend to upload the image from there. Here is an example of using the JSON API to upload an image to cloud storage, but in the end it's just a simple POST request which can easily be done in php.
Further info:
https://cloud.google.com/storage/docs/json_api/
https://cloud.google.com/storage/docs/json_api/v1/json-api-php-samples
I'm using Google Cloud Storage for media. My website is stored elsewhere. I want to serve medias for client users (through web browser), but I don't want to use public images (I want "keys"). I think it's possible on app engine (building URL), but my question is:
Is it possible to build URL to Google Cloud Storage stored medias from another server with PHP ? Or is there an API for calling Google Cloud Storage if my site is not on App Engine ?
Hope it's clear enough. Sorry, I did not found answer (I'm a new user).
Yes, the google-api-php-client library can be used outside of AppEngine. There is a PHP Example Tutorial to help you get started.
Can anyone help me draw out the code/ steps for uploading an image onto cloud SQL via the App engine? I take the snap from my Android app which calls the PHP app on the APP Engine.
Why would you upload to CloudSQL? You should be uploading to Cloud Storage.
Is this not clear enough?