Closed msinnott22 closed 2 years ago
@msinnott22 I have planned something similar for Skybrud.Social.Umbraco, which would then allow media upload from Google Drive, Dropbox and other relevant sources. But feel free to go ahead with your package ;) (mine probably won't be wrapped up anytime soon)
Anyways, my current implementation for Google Drive is rather limited at the moment. It was created as a proof of concept for a project we were working on - and so far it has only supported listing the files in a given folder.
I did however just had another look at the API, and adding logic for downloading a single file didn't take that long. So if you pull down the lastest code from this repository, you'll be able to do something like:
@using Skybrud.Social.Google.Drive.Responses.Files
@inherits WebViewPage<Skybrud.Social.Google.Common.GoogleService>
@{
DriveDownloadFileResponse response = Model.Drive.Files.DownloadFile("0B-qLiUlXpQmkOWZsRUZLUlRxMlk");
Response.Clear();
Response.ContentType = "image/png";
Response.BinaryWrite(response.Contents);
Response.End();
}
Given you have a MVC partial view, you can download the binary contents of a given file, and write it out to the response. In this case, 0B-qLiUlXpQmkOWZsRUZLUlRxMlk
is an image in my Google Drive, which I then can download and render in the browser.
I haven't pushed a new release yet, but I will look into that ;)
@abjerner Thanks for this, absolutely awesome!
I'll integrate this into my package, if I write anything useful relating to this, I'll be sure to submit a PR if I feel it worthy 😃
I'm currently attempting to create an Umbraco Package that will allow you to hook up to Google Drive for importing of media:- https://github.com/msinnott22/uDrive
I am planning on using your Plugin to make connections to APIs easier 😄
Does the beta version of this specific package have working Drive APIs?
Thanks!