Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Also dont forget to add Camera permission to android emulator </p> <p>HTML CODE:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Login Page&lt;/title&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt; &lt;script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"&gt;&lt;/script&gt; &lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" /&gt; &lt;script src="http://code.jquery.com/jquery-1.7.1.min.js"&gt;&lt;/script&gt; &lt;script src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; function PictureSourceType() {}; PictureSourceType.PHOTO_LIBRARY = 0; PictureSourceType.CAMERA = 1; function getPicture(sourceType) { var options = { quality: 10 }; if (sourceType != undefined) { options["sourceType"] = sourceType; // options["destinationType"] = destinationType.DATA_URL; } // if no sourceType specified, the default is CAMERA navigator.camera.getPicture(getPicture_Success, null, options); }; function getPicture_Success(imageData) { alert("getpic success "+ imageData); document.getElementById("test_img").src = imageData; }; function success(response) { alert("Your photo has been uploaded!"); }; // callback if the photo fails to upload successfully. function fail(error) { alert("if refreshed An error has occurred: Code = " + error.code); }; function uploadPhoto() { var imageFile = document.getElementById("test_img").src; alert(imageFile); var ft,options; options = new FileUploadOptions(); options.fileKey = "profile_image"; // name of the file: options.fileName = imageFile.substr(imageFile.lastIndexOf('/') + 1); // mime type: options.mimeType = "multipart/form-data"; params = { val1: "some value", val2: "some other value" }; options.params = params; ft = new FileTransfer(); ft.upload(imageFile, 'http://10.0.2.2:8080/cio/uploadpic', success, fail, options); alert("There is something called file transfer " + imageFile); }; &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div data-role="page" id="cameraPage"&gt; &lt;div data-role="header" data-position="inline"&gt; &lt;h1&gt;Edit profile Pic&lt;/h1&gt; &lt;a href="index.html" data-icon="delete" class="ui-btn-right"&gt;Cancel&lt;/a&gt; &lt;/div&gt; &lt;div data-role="content"&gt; &lt;center&gt; &lt;img style="width: 60px; height: 60px" id="test_img" src="" /&gt; &lt;/center&gt; &lt;button onclick="getPicture()"&gt;From Camera&lt;/button&gt; &lt;button onclick="getPicture(PictureSourceType.PHOTO_LIBRARY)"&gt;From Photo Library&lt;/button&gt; &lt;button onclick="uploadPhoto()"&gt;Upload Photo&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p></p> <p></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload