From 06a7b4d18bd5b0fe15cc921d35fa95cb46d91a70 Mon Sep 17 00:00:00 2001 From: Robert K Date: Tue, 21 Jun 2022 10:34:32 -0500 Subject: [PATCH] OB truncates output In some server configurations, output buffering will cause the image content to be truncated by approximately 5 rows of pixels. I can confirm that this happened with both PHP 7.4 and 8.0, using both GD and Imagick drivers. I was able to recreate the original issue by using `ob_start()` on the affected line using my local MAMP environment. Switching it to `ob_end_clean()` resolve the issue on both my development and the production machines. The solution is to just end output buffering before processing the response. --- src/Intervention/Image/ImageCacheController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Intervention/Image/ImageCacheController.php b/src/Intervention/Image/ImageCacheController.php index 37ae7ea..0295b67 100644 --- a/src/Intervention/Image/ImageCacheController.php +++ b/src/Intervention/Image/ImageCacheController.php @@ -20,6 +20,9 @@ class ImageCacheController extends BaseController */ public function getResponse($template, $filename) { + // Ensure that output buffering is off: + ob_end_clean(); + switch (strtolower($template)) { case 'original': return $this->getOriginal($filename);