Skip to content

Instantly share code, notes, and snippets.

@Hajto
Created February 21, 2015 12:01
Show Gist options
  • Save Hajto/59577ed160af13e32398 to your computer and use it in GitHub Desktop.
Save Hajto/59577ed160af13e32398 to your computer and use it in GitHub Desktop.
Debuging camera
var cameraSettings = {
quality: 50,
destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.CAMERA
};
var gallerySettings = {
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
quality: 50,
destinationType: Camera.DestinationType.FILE_URI
};
function camSuccess(fileUri) {
setBackgroundImages(fileUri);
localStorage.setItem("photo",fileUri)
}
function camError(error) {
console.log(error.message)
}
function setBackgroundImages(fileUri){
$("#goStartup").css({
"background": "none",
"background-image": "url('" + fileUri + "')",
"background-size": "cover"
});
$("#mainHolder").css({
"background": "none",
"background-image": "url('" + fileUri + "')",
"background-size": "cover"
})
}
function initBgPhoto(){
var uri = localStorage.getItem("photo");
if(uri != null && uri != undefined){
setBackgroundImages(uri)
}
}
function startGallery(){
navigator.camera.getPicture(
camSuccess,
camError,
gallerySettings);
}
function startCamera(){
navigator.camera.getPicture(
camSuccess,
camError,
cameraSettings);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment