From 00442ae7595bdc73b0cf851396b5993da1ba3a39 Mon Sep 17 00:00:00 2001 From: Nathan Booker Date: Fri, 5 Jul 2019 14:44:17 -0500 Subject: [PATCH] Add support for inherent width resizing Updating this regex to allow "100w" as well as "100x100" --- src/tools/image.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools/image.js b/src/tools/image.js index cec70be..69dbcfc 100644 --- a/src/tools/image.js +++ b/src/tools/image.js @@ -1,6 +1,7 @@ export default class { getSrc(path, dimensions) { - const sizeRegex = /^(\d+?)x(\d+?)$/g; + // Regex to test size string is of the form 123x123 or 100w + const sizeRegex = /(^\d+w$)|(^(\d+?)x(\d+?)$)/g; let size; if (typeof(dimensions) === 'object') {