Skip to content

Commit

Permalink
All images are stored as either WebP or SVG
Browse files Browse the repository at this point in the history
Even possibly superior formats such as AVIF and HEIF, because
browser support is not necessarily available, and it simplifies our
logic to serve images
  • Loading branch information
PowerKiKi committed Nov 12, 2024
1 parent 6813145 commit ef796bc
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/Model/Traits/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,10 @@ private function readFileInfo(): void
$tooBig = $size->getWidth() > $maxSize || $size->getHeight() > $maxSize;

// Pretty much only SVG is better than WebP
$worseThanWebp = in_array($this->getMime(), [
'image/avif',
'image/bmp',
'image/x-ms-bmp',
'image/gif',
'image/heic',
'image/heif',
'image/jpeg',
'image/pjpeg',
'image/png', // We lose animation, even though WebP supports it, but we assume we never use animated PNG anyway
// We lose PNG animation, even though WebP supports it, but we assume we never use animated PNG anyway
$worseThanWebp = !in_array($this->getMime(), [
'image/webp',
'image/svg+xml',
], true);

if ($tooBig || $worseThanWebp) {
Expand Down

0 comments on commit ef796bc

Please sign in to comment.