Skip to content

Remove JsonSerializable from EncodedImage - #1522

Merged
olivervogel merged 2 commits into
Intervention:developfrom
lazerg:bugfix/encoded-image-json-serializable
Aug 24, 2026
Merged

Remove JsonSerializable from EncodedImage#1522
olivervogel merged 2 commits into
Intervention:developfrom
lazerg:bugfix/encoded-image-json-serializable

Conversation

@lazerg

@lazerg lazerg commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

JsonSerializable on EncodedImage (added in #1513) makes Laravel's response layer treat any encoded image as JSON content and rewrite the response Content-Type to application/json, breaking return response($image->encode()), the most common way this library is used in HTTP contexts (also affects mewebstudio/captcha).

Color, DataUri, and Resolution keep JsonSerializable since they aren't normally returned as raw HTTP bodies. EncodedImage is the one that regularly is, so this just drops the interface there.

Fixes #1521

@olivervogel
olivervogel merged commit ddbe767 into Intervention:develop Aug 24, 2026
6 checks passed
olivervogel pushed a commit that referenced this pull request Aug 24, 2026
* Remove JsonSerializable from EncodedImage

* Tighten regression test comment and imports
@olivervogel

Copy link
Copy Markdown
Member

Yeah, maybe it's better this way. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

image content-type changed by Laravel

2 participants