It is possible to upload webcam images from the browser to Cloudinary.
Take a look at the following sample HTML5 code for capturing a webcam image.
http://jsfiddle.net/codepo8/agaRe/4/
The data
value in the takepicture
function is a data-uri image representation that you can upload to Cloudinary either directly from the browser using the jQuery plugin or through your server.
For direct image uploads, see: http://cloudinary.com/blog/direct_image_uploads_from_the_browser_to_the_cloud_with_jquery
You should add an image input file to your HTML form. For example, in Rails add the following command to your view (the resource type parameter is required in this case).
<%= cl_image_upload_tag(:image_id, :resource_type => :image, :html => {:class => "image_upload" }) %>
The following Javascript commands can be added to the takepicture
function for initiating upload to Cloudinary with the captured image:
$('.image_upload').fileupload('option', 'formData').file = data; $('.image_upload').fileupload('add', { files: [ data ] });
Comments
1 comment
Saved my day!!!
Very good.
Thanks
Please sign in to leave a comment.