The idea being that developers wont have to mess around with evil Flash/AS themselves, and instead can download a handy precompiled library that they just interact with via HTML/JS land.
Obviously what would be more ideal would be browser support for
<input type=camera> but that was apparently nixed from the HTML5 spec, so for now, this!
Differences from jpegcam
This project is forked from jpegcam (v1.08) by jhuckaby. The notable changes are:�
- TODO: Adding
console.logcalls via ExternalInterface in addition to
trace(), for ease of debugging in web browser with Firebug.
- Putting it on github, since git and github are awesome and allow for easier collaboration.
As per the parent project, it is licensed under LGPL license terms.
For now, look at the jpegcam documentation for basic setup stuff.
The main difference here is that once you
freeze() the image, instead of calling
upload(), you can call
dump() instead, which will return a base64 encoded JPEG to the callback handler.
Once you get the return value in the callback, you can just stick it in a hidden form value:
I'm assuming you already know what to do with a form!
You can even preview it by writing a data-uri into the src of an image. Assuming we have an image with
var p = document.getElementById('preview'); p.src = 'data:image/jpeg;base64,' + data;
Fun for the whole family.
Probably easiest to just look at the source code on the demo page.