You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-06-27 05:11:11 +02:00
feat(web/server): Face thumbnail selection (#3081)
* add migration * verify running migration populate new value * implemented service * generate api * FE works * FR Works * fix test * fix test fixture * fix test * fix test * consolidate api * fix test * added test * pr feedback * refactor * click ont humbnail to show feature selection as well
This commit is contained in:
19
web/src/lib/utils/thumbnail-util.ts
Normal file
19
web/src/lib/utils/thumbnail-util.ts
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Calculate thumbnail size based on number of assets and viewport width
|
||||
* @param assetCount Number of assets in the view
|
||||
* @param viewWidth viewport width
|
||||
* @returns thumbnail size
|
||||
*/
|
||||
export function getThumbnailSize(assetCount: number, viewWidth: number): number {
|
||||
if (assetCount < 6) {
|
||||
return Math.min(320, Math.floor(viewWidth / assetCount - assetCount));
|
||||
} else {
|
||||
if (viewWidth > 600) return viewWidth / 7 - 7;
|
||||
else if (viewWidth > 400) return viewWidth / 4 - 6;
|
||||
else if (viewWidth > 300) return viewWidth / 2 - 6;
|
||||
else if (viewWidth > 200) return viewWidth / 2 - 6;
|
||||
else if (viewWidth > 100) return viewWidth / 1 - 6;
|
||||
}
|
||||
|
||||
return 300;
|
||||
}
|
Reference in New Issue
Block a user