perf(thumbs): switch thumbnail encoding from WebP to JPEG q=80

Replace all 3 ImageFormat::WebP encode sites with JpegEncoder q=80.
Update fast-path to detect JPEG SOI instead of RIFF/WEBP magic.
Change file extension .webp -> .jpg, Content-Type headers, and
browser toBlob. Remove unused ImageFormat import and stale comments.
The webp feature stays for DECODING uploaded WebP images.
This commit is contained in:
Diocrafts
2026-03-07 20:37:19 +01:00
parent 05108d3e12
commit b8638f5131
4 changed files with 37 additions and 32 deletions
@@ -40,10 +40,10 @@ async fn generate_thumbnail_from_blob_path() {
let thumb_bytes = result.expect("thumbnail generation should succeed from blob path");
assert!(!thumb_bytes.is_empty(), "thumbnail bytes must not be empty");
// Verify it's valid WebP (starts with "RIFF" magic)
// Verify it's valid JPEG (starts with SOI marker 0xFF 0xD8)
assert!(
thumb_bytes.len() > 12 && &thumb_bytes[0..4] == b"RIFF",
"output should be WebP format"
thumb_bytes.len() > 2 && thumb_bytes[0] == 0xFF && thumb_bytes[1] == 0xD8,
"output should be JPEG format"
);
}