Sunday, March 19, 2017

Copy Paste Images from Clipboard in Blogger / Blogspot

I have always found it a bit annoying that it's necessary to upload images to Blogspot before being able to display them:
For this reason, I started looking for a windows application with a paste from clipboard option for images. Unfortunately, I was not able to find a free/open source solution. For this reason, I decided to build a workaround.

In this post I will explain how this works.

The basic idea is to use GreenShot for image capturing, an AWS server that hosts the images, a PuTTY pscp script to upload the file, and to copy a HTML text to the clipboard which you can paste into blogger.

This shows how the final solution works:

First start a screen capture with Greenshot:



And then select the option "upload". The script will then kick off and upload the screen capture to the AWS Server and return the HTML code that needs to be copied into Blogger:


This code is then copied into the HTML part of blogger:
Within Greenshot its possible to specify external commands. With this option a Bach file is started:

In here we configure the pointer to the batch file:
Also, in the settings, set the file format of the capture to hh mm to make sure the file names do not have spaces.



The batch file looks like this:


This script takes the path of the screen capture as a parameter and then uploads the file to the AWS Webserver. Unfortunately, the clip.exe command turned out the be buggy so I pasted the html code in a text document and then open this document with Notepad.

The webserver is a default (free of charge web-hosting AWS AMI):
First navigate to EC2 for elastic cloud options:

Launch an instance:

Search for the Wordpress AMI:

Select the free hosting option;

Then press next untill you get the option 'launch', press this as well. You will the see the screen to select a key pair, this is important:

Download the PEM file, we need this is the next step:
Use this file to create a pkk file, these steps have been described here:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html

Then, build the transfer script as described in the manual:

This script in part of the upload script:


No comments:

Post a Comment