Webserver: -fixe: photo quality is bad (using phonegap)
This commit is contained in:
1 parent
8c7fdc050f
commit
57770da524
1 file changed
+21
-19
+21
-19
@@ -9,16 +9,16 @@ var sessionId = "";
|
|||||||
var serverBaseAddress = "";
|
var serverBaseAddress = "";
|
||||||
|
|
||||||
if (document.location.protocol == "file:") {
|
if (document.location.protocol == "file:") {
|
||||||
if(typeof (window.deviceAndJqmLoaded) == "undefined"){
|
if (typeof (window.deviceAndJqmLoaded) == "undefined") {
|
||||||
window.deviceAndJqmLoaded = $.Deferred();
|
window.deviceAndJqmLoaded = $.Deferred();
|
||||||
}
|
}
|
||||||
window.deviceAndJqmLoaded.done(function(){
|
window.deviceAndJqmLoaded.done(function () {
|
||||||
start();
|
start();
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -173,29 +173,30 @@ function initPageLoadHandler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (document.location.protocol == "file:"
|
if (document.location.protocol == "file:"
|
||||||
&& typeof(navigator) != 'undefined'
|
&& typeof (navigator) != 'undefined'
|
||||||
&& typeof(navigator.camera) != 'undefined'
|
&& typeof (navigator.camera) != 'undefined'
|
||||||
&& typeof(navigator.camera.getPicture) != 'undefined') {
|
&& typeof (navigator.camera.getPicture) != 'undefined') {
|
||||||
navigator.camera.getPicture(function (imageData) {
|
navigator.camera.getPicture(function (imageData) {
|
||||||
$('#playerAvatar').prop("src", "data:image/jpeg;base64," + imageData);
|
$('#playerAvatar').prop("src", "data:image/jpeg;base64," + imageData);
|
||||||
$('#playerAvatar').data("changed", true);
|
$('#playerAvatar').data("changed", true);
|
||||||
}, function() {
|
}, function () {
|
||||||
//Fail - do nothing
|
//Fail - do nothing
|
||||||
}, {
|
}, {
|
||||||
destinationType: navigator.camera.DestinationType.DATA_URL,
|
destinationType: navigator.camera.DestinationType.DATA_URL,
|
||||||
allowEdit: true,
|
allowEdit: true,
|
||||||
correctOrientation: true,
|
correctOrientation: true,
|
||||||
saveToPhotoAlbum: true
|
saveToPhotoAlbum: true,
|
||||||
|
quality: 50
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$(document.body).append('<div id="captureContainer" style="height: 0px;width:0px; overflow:hidden;"> <input type="file" accept="image/*" id="capture" capture> </div>');
|
$(document.body).append('<div id="captureContainer" style="height: 0px;width:0px; overflow:hidden;"> <input type="file" accept="image/*" id="capture" capture> </div>');
|
||||||
|
|
||||||
$('#capture').change(function(eventData) {
|
$('#capture').change(function (eventData) {
|
||||||
if (eventData && eventData.target && eventData.target.files && eventData.target.files.length == 1) {
|
if (eventData && eventData.target && eventData.target.files && eventData.target.files.length == 1) {
|
||||||
var file = eventData.target.files[0];
|
var file = eventData.target.files[0];
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
reader.onloadend = function(e) {
|
reader.onloadend = function (e) {
|
||||||
$('#playerAvatar').prop("src", e.target.result);
|
$('#playerAvatar').prop("src", e.target.result);
|
||||||
$('#playerAvatar').data("changed", true);
|
$('#playerAvatar').data("changed", true);
|
||||||
$('#captureContainer').remove();
|
$('#captureContainer').remove();
|
||||||
@@ -817,7 +818,8 @@ function initMainPageHandler() {
|
|||||||
destinationType: navigator.camera.DestinationType.DATA_URL,
|
destinationType: navigator.camera.DestinationType.DATA_URL,
|
||||||
allowEdit: true,
|
allowEdit: true,
|
||||||
correctOrientation: true,
|
correctOrientation: true,
|
||||||
saveToPhotoAlbum: true
|
saveToPhotoAlbum: true,
|
||||||
|
quality: 100
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -931,10 +933,10 @@ function initDiscoverPageHandler() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//Fire pageLoadHandler for discover (first page shown after start)
|
//Fire pageLoadHandler for discover (first page shown after start)
|
||||||
setTimeout(function() {
|
setTimeout(function () {
|
||||||
pagebeforeshowDiscover();
|
pagebeforeshowDiscover();
|
||||||
$(this).removeData('promise');
|
$(this).removeData('promise');
|
||||||
},1);
|
}, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var cachedImages = {};
|
var cachedImages = {};
|
||||||
|
|||||||
Reference in new issue
Block a user