Update pms_image_proxy with helper function and encode URL params

This commit is contained in:
JonnyWong16 2020-02-19 19:57:56 -08:00
parent 3932409fb4
commit d752d46676
14 changed files with 136 additions and 64 deletions

View file

@ -717,3 +717,21 @@ function encodeData(data) {
return [key, data[key]].map(encodeURIComponent).join("=");
}).join("&");
}
function pms_image_proxy(img, rating_key, width, height, opacity, background, blur, fallback, refresh, clip, img_format) {
var img_info = {};
if (img != null) { img_info.img = img; }
if (rating_key != null) { img_info.rating_key = rating_key; }
if (width != null) { img_info.width = width; }
if (height != null) { img_info.height = height; }
if (opacity != null) { img_info.opacity = opacity; }
if (background != null) { img_info.background = background; }
if (blur != null) { img_info.blur = blur; }
if (fallback != null) { img_info.fallback = fallback; }
if (refresh != null) { img_info.refresh = true; }
if (clip != null) { img_info.clip = true; }
if (img_format != null) { img_format.img_format = img_format; }
return 'pms_image_proxy?' + $.param(img_info);
}