Photo: Open Live Writer running on Windows 10, taken at Docklands Melbourne. This image was published to this Blogger blog with Open Live Writer.
Beginning from the next release of Open Live Writer (0.6.3), Blogger users will now be able to successfully post images to their blogs again. After being affected by the issue myself in my own usage of the software, I took it upon myself to develop and deliver a fix. Today, Open Live Writer will, instead of uploading to Google Photos using the now non-functional Picasa API, upload to Google Drive, publicly link-share the photo, and then embed the direct URL to the image within your post. This all happens automatically from within Open Live Writer, there are no work-arounds or hacks at play.
When I began on this project, I first attempted to investigate the least invasive options first. My goal was to find a 1:1 replacement that optimally did not require the user to log in to any additional accounts. Initially, I tried using Google Photos and their API, but I quickly discovered that Google Photos does not have an API client library available for .NET. I was easily able to work around this by using the Google apis-client-generator, which generated the .NET client library with most of the methods I needed. I was able to successfully detect the user’s albums, find the ‘Open Live Writer’ album or create it if it didn’t exist, and upload the user’s images to it. I began to run into issues when it came time to embed. Whilst it is possible to share the photos publicly with the Google Photos API, it is not possible to generate a permanent URL pointing directly to the image file on Google. I investigated how the ‘Embed Google Photos’ tools online implemented it, however they all depended on having a link to the image inside the Google Photos album viewer; something I also did not have.
It was at this point I started researching alternative options. Whilst I was working on the fix, I was keeping in contact with the Open Live Writer community via the relevant GitHub issue (#786). It was suggested to me to try Google Drive integration, which is what I then started working on and ultimately implemented. The Google Drive API is extremely similar to the Photos API, and changing over my existing code was as simple as pulling down the NuGet package and reading the docs to replace the Photos methods with their Drive equivalents. Unlike the Photos API client which was generated by apis-client-generator, the Drive API .NET client had built-in support for content uploads, making the switch-over very easy.
In the end, I was able to achieve a fix which was workflow-identical to the previous Picasa integration. Users will have to re-add their Blogger accounts to Open Live Writer so the appropriate authentication tokens are generated, however past that point there is no substantial difference in the usage of the application. In regards to the implementation behind the scenes, there are a few differences which may affect some users. A new folder titled ‘Open Live Writer’ is created on the user’s Google Drive. If a folder already exists with this title that was created by the user or another application, an error may occur as Open Live Writer will only request permissions to files that it itself has created. As images are now being uploaded as files, they may be hard to organise if the user chooses to do so. Each image is uploaded with a unique GUID, and whilst you can sort in Drive by date to download or delete unwanted images, there is no easy way to identify which images are what when viewing the folder on Google Drive. However I suspect very few users will encounter these issues, and it would be trivial to adjust the behaviours mentioned above if need-be.
There are some concerns which are still present, such as public file bandwidth limits on Drive. I was not able to easily seek an answer for this online, however I’m assuming based on the image sizes that are typically uploaded by Open Live Writer that this will not be an issue for most low-to-mid traffic blogs. An eventual plan of mine is to implement modular image host support for OLW, allowing users to choose whatever image host they want with whatever blog host they want. But for now, this seems to work just fine. Now it’s time for me to write some cool posts with photos! :)