mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Added remote desktop WebP support.
This commit is contained in:
parent
9d03981bfc
commit
dea1df33b6
5 changed files with 53 additions and 13 deletions
|
@ -127,4 +127,26 @@ function parseUriArgs() {
|
|||
if (!isSafeString(r[name])) { delete r[name]; } else { var x = parseInt(r[name]); if (x == r[name]) { r[name] = x; } }
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
// check_webp_feature:
|
||||
// 'feature' can be one of 'lossy', 'lossless', 'alpha' or 'animation'.
|
||||
// 'callback(feature, isSupported)' will be passed back the detection result (in an asynchronous way!)
|
||||
// From: https://stackoverflow.com/questions/5573096/detecting-webp-support
|
||||
function check_webp_feature(feature, callback) {
|
||||
var kTestImages = {
|
||||
lossy: "UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"//,
|
||||
//lossless: "UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==",
|
||||
//alpha: "UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",
|
||||
//animation: "UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"
|
||||
};
|
||||
var img = new Image();
|
||||
img.onload = function () {
|
||||
var result = (img.width > 0) && (img.height > 0);
|
||||
callback(feature, result);
|
||||
};
|
||||
img.onerror = function () {
|
||||
callback(feature, false);
|
||||
};
|
||||
img.src = "data:image/webp;base64," + kTestImages[feature];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue