in source/image-handler/thumbor-mapper.ts [302:329]
private mapResize(path: string): ImageEdits {
// Process the dimensions
const dimensionsMatchResult = path.match(/\/((\d+x\d+)|(0x\d+))\//g);
if (dimensionsMatchResult) {
// Assign dimensions from the first match only to avoid parsing dimension from image file names
const [width, height] = dimensionsMatchResult[0]
.replace(/\//g, '')
.split('x')
.map(x => parseInt(x));
// Set only if the dimensions provided are valid
if (!isNaN(width) && !isNaN(height)) {
const resizeEdit: ImageEdits = { resize: {} };
// If width or height is 0, fit would be inside.
if (width === 0 || height === 0) {
resizeEdit.resize.fit = ImageFitTypes.INSIDE;
}
resizeEdit.resize.width = width === 0 ? null : width;
resizeEdit.resize.height = height === 0 ? null : height;
return resizeEdit;
}
}
return ThumborMapper.EMPTY_IMAGE_EDITS;
}