Skip to content

Commit

Permalink
BUGFIX: Catch case where image could not be rendered but no exception…
Browse files Browse the repository at this point in the history
… was thrown
  • Loading branch information
mficzel committed Sep 23, 2019
1 parent 03aade5 commit 8130a6e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Classes/Controller/DummyImageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,16 @@ public function imageAction (int $w = 600, int $h = 400, string $bg = '#000', st
$this->renderPattern($image, $renderShape ? $backgroundColor : $foregroundColor, $width, $height, $text);
}

// render image
$result = $image->get($f);
if (!$result) {
throw new \Exception('Something went wrong without throwing an exception');
}

// build result
$this->response->setHeader('Cache-Control', 'max-age=883000000');
$this->response->setHeader('Content-type', 'image/' . $f);
return $image->get($f);
return $result;
} catch (\Exception $e) {
// something went wrong we return the error image png
$this->response->setStatusCode(500);
Expand Down

0 comments on commit 8130a6e

Please sign in to comment.