This repository has been archived by the owner on Dec 9, 2023. It is now read-only.
Output buffering may truncate image output #127
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In some server configurations, output buffering will cause the image content to be truncated by approximately 5 rows of pixels. I confirmed that this happened with both PHP 7.4 and 8.0, using both GD and Imagick drivers.
To verify, I recreated the original issue by using
ob_start()
on the same line in my local MAMP environment. Output was then truncated, and my browser showed an image corrupt message. Swapping it for the correctob_end_clean()
resolved the issue on both my development and the production machines.This just ensures that any automatic output buffering is turned off properly.