Allow max image side length to be configurable

This commit is contained in:
Petr Sloup 2016-08-25 09:41:33 +02:00
parent 78aea26318
commit 90b9af3d95
2 changed files with 8 additions and 2 deletions

View file

@ -23,7 +23,8 @@ Example::
"png": 90,
"jpeg": 80,
"webp": 90
}
},
"maxSize": 2048
},
"styles": {
"basic": {
@ -69,6 +70,11 @@ You can use this to optionally specify on what domains the rendered tiles are ac
Quality of the compression of individual image formats. [0-100]
``maxSize``
-----------
Maximum image side length to be allowed to be rendered (including scale factor). Default is ``2048``.
``styles``
==========

View file

@ -254,7 +254,7 @@ module.exports = function(options, repo, params, id, dataResolver) {
return res.status(400).send('Invalid center');
}
if (Math.min(width, height) <= 0 ||
Math.max(width, height) * scale > 2048) {
Math.max(width, height) * scale > (options.maxSize || 2048)) {
return res.status(400).send('Invalid size');
}
if (format == 'png' || format == 'webp') {