Skip to content

Commit

Permalink
Add webp and avif to list of transparent images
Browse files Browse the repository at this point in the history
  • Loading branch information
daun committed Oct 25, 2024
1 parent 7511efd commit 447e603
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion resources/js/components/fieldtypes/assets/Asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default {
},

canBeTransparent() {
return ['png', 'svg'].includes(this.asset.extension)
return ['png', 'svg', 'webp', 'avif'].includes(this.asset.extension)
},

canDownload() {
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Resources/CP/Assets/FolderAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function toArray($request)
return [
'is_image' => true,
'thumbnail' => $this->thumbnailUrl('small'),
'can_be_transparent' => $this->isSvg() || $this->extension() === 'png',
'can_be_transparent' => $this->isSvg() || $this->extensionIsOneOf(['svg', 'png', 'webp', 'avif']),
'alt' => $this->alt,
];
}),
Expand Down

0 comments on commit 447e603

Please sign in to comment.