feat: add view transform, photo loading and download helpers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
immortaly007andClaude Opus 5.5 committed 2026-10-15 14:45:38 +02:00
1 parent 0a97cb88af
commit 99cafc0b55
5 files changed
+102

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
import { describe, expect, it } from 'vitest';
import { fitSize, MAX_SIDE } from '../src/lib/load-image';
describe('fitSize', () => {
it('downscales a 12 MP landscape photo to the max side', () => {
expect(fitSize(4000, 3000, MAX_SIDE)).toEqual({ width: 2000, height: 1500 });
});
it('downscales portrait photos by their height', () => {
expect(fitSize(3024, 4032, 2000)).toEqual({ width: 1500, height: 2000 });
});
it('never upscales small images', () => {
expect(fitSize(800, 600, 2000)).toEqual({ width: 800, height: 600 });
});
});