From b6d5b493cc1763d64f3cd3352f88661a1a5f8c3e Mon Sep 17 00:00:00 2001 From: Nick de Kruijk Date: Thu, 4 Oct 2018 10:47:36 +0200 Subject: [PATCH] Check if output value is valid --- src/ResizeController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ResizeController.php b/src/ResizeController.php index 9bd3cf1..3507694 100644 --- a/src/ResizeController.php +++ b/src/ResizeController.php @@ -145,7 +145,11 @@ private function resize($template, $original, $target) # Change type to force output format if used in template if (isset($template['output'])) { - $type = 'image/' . $template['output']; + if (in_array($template['output'], ['jpg', 'jpeg', 'png', 'gif'])) { + $type = 'image/' . $template['output']; + } else { + self::error('Invalid output ' . $template['output']); + } } # Save the resized image in a variable