Skip to content

Commit

Permalink
add .webp extension
Browse files Browse the repository at this point in the history
  • Loading branch information
artgris committed Mar 21, 2024
1 parent 6544e06 commit c72fc90
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Helpers/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct(private SplFileInfo $file,private TranslatorInterfac
* @return array|false|string
*/
public function getDimension(): bool|array|string {
return preg_match('/(gif|png|jpe?g|svg)$/i', $this->file->getExtension()) ?
return preg_match('/(gif|png|jpe?g|svg|webp)$/i', $this->file->getExtension()) ?
@getimagesize($this->file->getPathname()) : '';
}

Expand Down
2 changes: 1 addition & 1 deletion Resources/doc/book/1-basic-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ artgris_file_manager:

`media`: `/\.(mp4|ogg|webm)$/i` Accept basic HTML video media types (.mp4, .ogg and .webm)

`image:`: `/\.(gif|png|jpe?g|svg)$/i` Accept basic HTML image types (.gif, .png, .jpg, .jpeg and .svg)
`image:`: `/\.(gif|png|jpe?g|svg|webp)$/i` Accept basic HTML image types (.gif, .png, .jpg, .jpeg, .svg and webp)

`file`: `/.+$/i` Accept all files with an extension (.pdf, .html, ...)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
options: {
// The regular expression for the types of images to load:
// matched against the file type:
loadImageFileTypes: /^image\/(gif|jpeg|png|svg\+xml)$/,
loadImageFileTypes: /^image\/(gif|jpeg|png|webp|svg\+xml)$/,
// The maximum file size of images to load:
loadImageMaxFileSize: 10000000, // 10MB
// The maximum width of resized images:
Expand Down
2 changes: 1 addition & 1 deletion Service/FileTypeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function fileIcon(string $filePath,?string $extension = null, ?int $size
case preg_match('/(mp3|wav)$/i', $extension):
$fa = 'far fa-file-audio';
break;
case preg_match('/(gif|png|jpe?g|svg)$/i', $extension):
case preg_match('/(gif|png|jpe?g|svg|webp)$/i', $extension):

$fileName = $filePath;
if ($cachebreaker) {
Expand Down

0 comments on commit c72fc90

Please sign in to comment.