easily change/getting image from googledrive and display in website - php

from this article https://support.google.com/drive/answer/2881970?hl=en . google doesn't support web hostings. Is there any way that i can get my image from googledrive for example like this:
for example i have a shared folder like this:
https://drive.google.com/drive/folders/0ByzxsoB7kICPUjVEVG12a0hNSWc
and that shared folder contains with
myimage1.jpg,
myimage2.jpg,
myimage3.jpg,
i want to select/change it in my website by using that image.
For example i uploaded another image in my googledrive to replace my web image easily. Please help.
something like this :
<img src = "googledriveimage/myimage1.jpg">
after i want to replace the image. then i would go to googledrive and replace the myimage1.jpg with another image but the same file name.

You could write a PHP script to fetch the desired image from google drive and return it back to the HTTP client.
Refer to the flow in the diagram:
User views the HTML page in his/her browser
The browser sends a HTTP GET request to your PHP script.
The PHP script is hosted either in a publicy accessible web server (or uses a cloud service provider e.g. Google App Engine, you could use any cloud hosting service provider). The script would use the Google Drive SDK to use OAUTH and request the pre-specified image file from Google Drive. Here, you need to use either the SDK or wrap the request in the proper JSON/XML format as specified by Google Drive API. You need to embed the desired logic of translating a front-end visible image filename to the real Google Drive filename.
Google drive translates the request, checks authentication and retrieves the image.
The image is returned back to the PHP script.
The PHP script encodes the image and sets the right MIME type, headers, etc.
The user is able to view the image on the page.
To clarify, you dont need to host your PHP script in Google App Engine, you could host it on any other web hosting provider infrastructure.
I've used Google drive APIs in servlets deployed on Google App engine. I haven't used PHP in GAE, but have quoted the PHP references since you indicated familiarity with PHP. If you're interested in using GAE, first read the concepts related to GAE here https://cloud.google.com/appengine/docs/php/concepts and then the PHP how-tos for using the SDK and deploying the app using PHP - https://cloud.google.com/appengine/docs/php/how-to . Also refer to this documentation - https://cloud.google.com/appengine/docs/php/ .
I've included the concept of how you can solve your problem, you need to go through the documents and implement this yourselves.

Related

PHP files on Google cloud storage without AppEngine

I'm trying to link php files on Google cloud storage, but getting them as plain text. I want to connect to the other file but without App Engine, all the documentation of this is written exclusively for app engine and can't even find if bucket storage has php support even tho it should. Any clue of how to link a PHP file correctly on Cloud Storage?
Google cloud storage is storage service which can store your object(files) and return when you ask for it.Files like HTML,JavaScript and CSS that render inside browser can be placed on google cloud storage to get performance in loading time.But in your php file need execution engine to run it code.Placing them on storage and accessing will get to file context.

How do you generate signed urls for google cloud storage objects in PHP?

First, let me tell you what i'm trying to accomplish...maybe there's an easier way than using signed urls with google cloud storage:
i want to upload files without public access to my bucket and when someone navigates to my server (that's not a google compute engine instance, but a regular cpanel machine) it should display the files just fine.
One way of doing it is through an url on my server that would download the file from google storage and serve it to the browser, but that's slow.
Another way that i've found was using these signed urls of google's. My problem would be: how do i generate them in PHP using the current APIs from google ?
I doubt it's of any importance but i'm using phalcon as my backend framework.
Thanks.

How to integrate iiif image viewer in Php project?

I want to use iiif http://iiif.io/ in my Codeigniter project but I haven't found any helpful link or demo which can help me to use this framework.
I'm also planning to use http://www.iiifhosting.com/ for hosting images and its demo shows they provide an image viewer too, but can I customise this viewer just like IIPMooViewer, Mirador, OpenSeadragon or any other viewer listed in iiif.io viewer list?
According to the documentation:
The IIIF [International Image Interoperability Framework] Image API specifies a web service that returns an image in response to a standard HTTP or HTTPS request. The URI can specify the region, size, rotation, quality characteristics and format of the requested image.
For the server, you can deploy your own server such as Loris or IIPImage server. You can also use an hosting service such as http://www.iiifhosting.com/ .
For the client, you can integrate a client such as Mirador, OpenSeadragon into your website but you can also directly use the IIIF protocol, using the URI syntax:
{scheme}://{server}{/prefix}/{identifier}/{region}/{size}/{rotation}/{quality}.{format}

Is it possible to store files uploaded on your website to google drive?

We have our company website and we have many job opportunities often. So we have created a form where in interested candidates can apply directly. We also have a resume upload facility, right now resumes are uploaded and stored using PHP this resumes are stores onto our server, but we don't want to waste server space so we were thinking to just create one dedicated folder for resumes on Google drive and whenever user uploads his resume from our web site it will get stores onto a Google drive folder. Is this possible. We don't want to do it with Google forms or form+ since we have form matching our website theme.
It is possible to integrate into your website the Google Drive SDK which can allow you to do just that. You should look here for the PHP tutorial.
So yes, you can directly store the documents on the Google Drive using the API provided here. Look over here to access the more specifics for file uploading.
yes, it is possible with the php google class.
a very good example you can get from: http://hublog.hubmed.org/archives/001954.html

Online file storage logic

I want to develop a website like file manager. Where user register and will get fix disk space lets say 20MB.
Now user can upload their pdf, doc, txt, jpeg etc files upto their disk limit.
I can develop upto this using PHP.
Now below is my issue:
1) If user's files are corrupted they can rollback their folders before 2-3 days.
Files must be secure and safe from viruses as users are uploading their important documents.
Is there any 3rd party storage server who provides such facility?
2) Also all files should be previewed from browser.
I am using Google doc viewer. Is is good and safe way to preview file in browser?
But google links are accessible from all, I need to add some restrictions as file can be viewed only by their owner.
I know it's a major task, but i just need some sort of logic. Please share your thoughts.
Thanks.
Any cloud storage service can be used for this. You'll get HDD space. There is not storage server who provides revision control system for this. You can use git, svn for this though. But as the files are binary you can not get full facility of these tools.
How file will be previewed depends on you. If you use PHP you make the site and at the backend you use the API to interact with the storage service. Google doc is not an option for this if you use PHP. Also note Google links can be made private.
I suggest you this,
Find a cloud storage service and use the storage in your server. Any will do.
Create UI using PHP and control the access using PHP too.
Manipulate files in your server directly or in 3rd party storage server via API
Use a revision control system to track the changes. And use its API in PHP end.
Some cloud storage service
Amazon S3. It also supports Versioning.
Google Cloud Storage
Microsoft Azure
Try Microsoft SkyDrive or Google Drive or Dropbox

Categories