[Owasp-o2-platform] Fwd: [New post] Testing using GitGub hosted images for WordPress.com blog posts

dinis cruz dinis.cruz at owasp.org
Sun Mar 18 06:30:12 UTC 2012


Next version of O2 has full Git support :)

Dinis Cruz

Begin forwarded message:

*From:* OWASP O2 Platform Blog <donotreply at wordpress.com>
*Date:* 18 March 2012 06:15:16 GMT
*To:* o2 at ddplus.net
*Subject:* *[New post] Testing using GitGub hosted images for
WordPress.comblog posts
*

WordPress.com
      New post on *OWASP O2 Platform Blog*
<http://o2platform.wordpress.com/author/o2platform/>  Testing using GitGub
hosted images for WordPress.com blog
posts<http://o2platform.wordpress.com/2012/03/18/testing-using-gitgub-hosted-images-for-wordpress-com-blog-posts/>
by
Dinis Cruz <http://o2platform.wordpress.com/author/o2platform/>

One of the things that has been a massive pain when writing these blog
posts has been the really bad workflow that WordPress.com has to deal with
image's uploads.

The workflow that I want is one where I can take a screenshot into my
local clipboard and 'automagically' that image is available to be inserted
in the blog (I'm happy to wait a coupe seconds as long as no other action
is needed).

In the past, I did come up with a 'semi automated way' to upload these
images via WordPressweb GUI (see O2 Script to automatically upload
clipboard images to
WordPress.com<http://o2platform.wordpress.com/2011/04/16/o2-script-to-automatically-upload-clipboard-images-to-wordpress-com/>),
but it was not 100% stable and recently that O2 script stopped working
since WordPress.com changed its own image uploading code .

Since I'm now heavily into Git, and GitHub, I was thinking *'why don't I
copy the image from the clipboard into a local Git Repository, then push
that repository to the web, and expose the GitHub raw link available'*

And with the latest version of O2 (in .NET 4.0 + native .NET Git suport) I
was able to build such Gui.

*Here it is in action:*



After taking a screenshot, click on the *'Commit...'* link and eventually
the image will be shown in a WebBrowser and the image URL is also placed in
the clipboard (for example
https://github.com/DinisCruz/Images/raw/master/images/3_18_2012_6_00_48_AM.jpg
)

Now to add an image to a blog post (like this one), one can use the url in
the clipboard, or just drag and drop the image from the WebBrowser:

*Here is the code that creates this GUI*

var topPanel = O2Gui.open("Util - Copy Clipboard Image to GitHub
Repository",400,400);
//var topPanel = panel.clear().add_Panel();
var actionsPanel = topPanel.insert_Above(40, "Actions");
var url_TextBox = topPanel.insert_Above(20).add_Label("Image
Url").append_TextBox("").align_Right();
var browser = topPanel.add_WebBrowser_Control();
topPanel.insert_LogViewer();
var localRepository = @"C:\_WorkDir\O2\Images"
var nGit = new API_NGit();
nGit.open(localRepository);
actionsPanel.add_Link("Open Screenshot tool", ()=> API_Cropper.openGui())
            .append_Link("Commit image from clipboard and push",
                        ()=>{

                                var image =
localRepository.pathCombine("images").createDir().saveImageFromClipboardToFolder();
                                if (image.notNull())
                                {
                                    var o2Timer = new O2Timer("upload
to Git").start();
                                    var url =
"https://github.com/DinisCruz/Images/raw/master/images/{0}".format(image.fileName());
                                    "Current Status: {0}".info(nGit.status());

nGit.add_and_commit_using_Status();
                                    nGit.push();
                                    "Url copied to Cliboard: {0}".info(url);
                                    url.clipboardText_Set();
                                    o2Timer.stop();
                                    browser.open(url);
                                }
                            });

return nGit;
//O2File:API_NGit.cs
//O2File:API_Cropper.cs
//O2Ref:NGit.dll
//O2Ref:NSch.dll
//O2Ref:Mono.Security.dll
//O2Ref:Sharpen.dll

//O2Tag_DontAddExtraO2Files

  *Dinis Cruz <http://o2platform.wordpress.com/author/o2platform/>* | March
18, 2012 at 6:15 am | Categories:
.NET<http://o2platform.wordpress.com/?cat=2427>,
GitHub <http://o2platform.wordpress.com/?cat=5603054> | URL:
http://wp.me/pUfv6-nb

 Comment<http://o2platform.wordpress.com/2012/03/18/testing-using-gitgub-hosted-images-for-wordpress-com-blog-posts/#respond>
   See all comments<http://o2platform.wordpress.com/2012/03/18/testing-using-gitgub-hosted-images-for-wordpress-com-blog-posts/#comments>

     Unsubscribe or change your email settings at Manage
Subscriptions<https://subscribe.wordpress.com/?key=3b791628ad2c78549a5f5f07698d0676&email=o2%40ddplus.net>.


*Trouble clicking?* Copy and paste this URL into your browser:
http://o2platform.wordpress.com/2012/03/18/testing-using-gitgub-hosted-images-for-wordpress-com-blog-posts/
         Thanks for flying with WordPress.com <http://wordpress.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.owasp.org/pipermail/owasp-o2-platform/attachments/20120318/de34e2f8/attachment.html>


More information about the Owasp-o2-platform mailing list