Skip to content

Commit 2ebbf8b

Browse files
author
Oscar Otero
committed
added support to webp
1 parent d179da2 commit 2ebbf8b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [3.0.0] - 2019-11-29
9+
### Added
10+
- Support for webp responses under the `ImageFormatter` error handler
11+
912
### Changed
1013
- Merged `JpegFormatter`, `GifFormatter` and `PngFormatter` in one `ImageFormatter`.
1114
- By default, all formatters are used.

src/ErrorFormatter/ImageFormatter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class ImageFormatter extends AbstractFormatter
1111
'image/gif',
1212
'image/jpeg',
1313
'image/png',
14+
'image/webp',
1415
];
1516

1617
protected function format(Throwable $error, string $contentType): string
@@ -28,6 +29,9 @@ protected function format(Throwable $error, string $contentType): string
2829
case 'image/png':
2930
imagepng($image);
3031
break;
32+
case 'image/webp':
33+
imagewebp($image);
34+
break;
3135
}
3236

3337
return (string) ob_get_clean();

0 commit comments

Comments
 (0)