roguish

Sending Images from Flash Player using HTTP POST

Flash Player can send images to web services like Amazon AWS. The built-in behavior requires the user to browse to an image on the user’s system using a system dialog to select the image for sending. It is possible to send an image from Flash Player without requiring the use of a system dialog to locate the image file, and even without the requirement of saving the image to the system before sending it! In fact, images can be sent without any user interaction whatsoever.

In a recent application we developed, we deployed a solution for capturing BitmapData of a playing video and sent the image to Amazon AWS. The thumbnail could be retrieved later for populating a display of the user’s video bookmarks.

  1. Capture a BitmapData object of something being displayed in a SWF – any display object
  2. Convert it to JPG. Several methods are available, we used: https://github.com/LeeBurrows/Async-Image-Encoders
  3. Using HTTP POST, send the image to Amazon (or anywhere) for storage. This is the difficult part. We derived our solution from Open Booth: https://github.com/obsesh/openbooth/

Open Booth was based on:
http://marstonstudio.com/2007/10/19/how-to-take-a-snapshot-of-a-flash-movie-and-automatically-upload-the-jpg-to-a-server-in-three-easy-steps/

… which was in turn based on the work of Joa Ebert.

The technique employed writes the necessary headers to the HTTP Post call so that no PHP intermediary is required to send captured image data directly from Flash Player.

Here’s a direct link to the relevant HTTP Post class in Open Booth:
https://github.com/obsesh/openbooth/blob/master/s3/flash/UploadPostHelper.as

One ResponseLeave one →

  1. Hi, His solution of using multipart/form-data was dumb. Sorry but it’s true. Simply use application/octet-stream and be on your way. :)

    Reply

Leave a Reply