by
3 9
0
3
1,682
25
Top 1% !
Famous
Specified
Popularity: 16979th place

Published on:

No tags for this snippet yet.
LanguageHTML
SourceGitHub
TechnologyAJAX
TechnologyJQuery

Cordova Camera Plugin cordova-plugin-camera upload jquery ajax to server request

Cordova Camera Plugin cordova-plugin-camera upload jquery ajax to server request: 
cordova-plugin-camera-index.html
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/1168177/Cordova-Camera-Plugin-cordova-plugin-cam?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
<!DOCTYPE html> <!-- Aysad Kozanoglu --> <html> <head> <title>foto cek</title> <style> html { -webkit-user-select: none; } </style> <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;" /> <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script> <script type="text/javascript" charset="utf-8" src="cordova.js"></script> <script type="text/javascript" charset="utf-8"> var pictureSource; // picture source var destinationType; // sets the format of returned value // Wait for device API libraries to load // function onLoad() { document.addEventListener("deviceready", onDeviceReady, false); } // device APIs are available // function onDeviceReady() { pictureSource=navigator.camera.PictureSourceType; destinationType=navigator.camera.DestinationType; } // Called when a photo is successfully retrieved // function onPhotoDataSuccess(imageData) { var smallImage = document.getElementById('smallImage'); smallImage.style.display = 'block'; smallImage.src = "data:image/jpeg;base64," + imageData; fotoUpload(imageData); } // A button will call this function // function capturePhotoEdit() { // Take picture using device camera, allow edit, and retrieve image as base64-encoded string navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 20, allowEdit: true, destinationType: destinationType.DATA_URL }); } // Called if something bad happens. // function onFail(message) { alert('Failed because: ' + message); } </script> </head> <body onload="onLoad()"> <center> <img src="logo.png" width="50%" border=0> <br> <h1>Entwicklungsumgebung</h1> <br> Kamera Photoschuss und upload Server <br><br><br><br> <button onclick="capturePhotoEdit();" style="height:60px;width:80%">Photo Schnappschuss</button> <br><br><br> <a href="http://5.45.96.121/upload/" target ="_blank"> <h2>Bilder auf dem Server ansehen </h2></a> <br><br><br> <div id="ajaxStatus"></div> <img style="display:none;width:50%" id="smallImage" src="" /> <br><br><font size="-2"> Erfinder: Levent Yakar <br> Architekt: Aysad Kozanoglu <script type="text/javascript" charset="utf-8"> $(document).ready(function(){ $("#ajaxStatus").html("ein Bild aufnehmen"); }); function fotoUpload(imageData){ //alert(imageData); $.ajax({ type: "POST", url: "http://5.45.96.121/upload/up2.php", data: { img_data:imageData}, cache: false, contentType: "application/x-www-form-urlencoded", success: function (result) { alert("upload OK: "+ result); } }); $("#ajaxStatus").html("bild hochgeladen"); } </script> </body> </html>
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus