SUPA - The Screenshot UPload Applet

Intendet audience: Developers

Introduction

Supa is intended to make uploading screenshots to websites a whole lot easier.
Upload images The Supa Way:
  1. Go to webpage and paste the image directly
  2. Be Happy
The Olden Way:
  1. Save screenshot (or some other image) from your clipboard to file
  2. Open webpage
  3. Search for the file you just saved
  4. Upload
This applet is no standalone product but intended to be included in your own application.

Demo

There"s a Demo available. Its source is provided in the downloadable package.

Prerequisites

Unfortunately, this exquisite usability enhancements comes at a price. Local clipboard access is denied for security reasons and as such is not accessible through "normal" web methodologies.
Supa is implemented using a signed Java Applet (Java-Plugin 1.6 required). This allows for local clipboard access but requires developer/administrator action on deployment.
Furthermore the end user usually has to manually accept the signed java applet at lest once. In a controlled environment this might be worked around by an administrator, see Installation.

Integration in your project

Example code is provided in the downloadable package. See demo.php and upload.php for more details.
You need to create an <applet> or similar tag in your HTML page and include the supplied SupaApplet from Supa.jar. This applet does expose three functions that should be wrapped by javascript:
Get the image from the applet using getClipboardContents() and post this to your website.
The provided java applet (the .jar file) is signed to enable local clipboard access. However, the certificate used is publicly available through the project Subversion repository and must not be used in a production environment. See the official documentation about signing java applets.

Applet Methods

pasteFromClipboard()

This method retrieves the current clipboard content into the applet.

clear()

Clear the current image.

getClipboardContents()

The return value of this method is a (usually) base64 encoded string representation of the image that was pasted using pasteFromClipboard().

Applet parameters

These are the applet initialization parameters:

ClickForPaste (boolean=false)

If set to true, clicking on the applet pastes the clipboard content.

imagecodec (string="png")

The pasted image will get converted to this image format. Supported values (atm): "jpg", "png"

encoding (string="base64")

This determines the encoding used by method getClipboardContents(). Supported values (atm): "none", "base64"

previewscaler (string="fit to canvas")

In which way should the preview be scaled. Supported values: "fit to canvas", "original size";

trace (boolean=false)

Do some output on the java plugin console. Intended for debugging purposes only.

Download

Everything you need is available at the download page.

Support

Please visit our Support facilities at SourceForte.net.

Whatever

For more details visit the Sourceforge-Site
Have fun using this applet in your projects and drop me a note if you liked it...