Skip to content

Make renderer respect width and height from query params #159

@Poitrin

Description

@Poitrin

When calling /renderwindow/preview/?width=426px&height=240px, the query parameters (width, height) have no effect, because they are overridden by the config file, see code:

function getResolutionFromConfig(cfg, postRequest) {
// Added in 1.3.0 to get resolution
// returns CSS values: {width: x, height: y}
let sizeID = cfg.general.resolution || 'HD';
let width = '1920px';
let height = '1080px';
if (postRequest.width ) { width = postRequest.width }
if (postRequest.height) { height = postRequest.height }
switch(sizeID) {
case '4K':
width = '3840px'
height = '2160px'
break;
case 'AUTO':
width = '100vw'
height = '100vh'
break;
default:
// HD is the default
width = '1920px'
height = '1080px'
break;
};
return {
width: width,
height: height,
};
} // getResolutionFromConfig ended

Based on the existing code, I assume that returning an object with width and height if query parameters are present solves the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions