fix: stop the YouTube covers coming out blurry and cropped
The ytimg variants are 16:9, so picking one by width handed a square tile far fewer pixels than it needed: a 96px cover got the 120x90 file and kept 90px after the crop. They are chosen by their short side now, the album art is preferred over the video frame when the search returns both, and the display sizes account for the tiles being up to 180px on a 2x screen.
This commit is contained in:
@@ -55,9 +55,9 @@ export function resizeThumbnailUrl(url: URL, size: number): string {
|
||||
}
|
||||
|
||||
function ytImgFileName(size: number): string {
|
||||
if (size <= 120) return 'default.jpg';
|
||||
if (size <= 320) return 'mqdefault.jpg';
|
||||
if (size <= 480) return 'hqdefault.jpg';
|
||||
if (size <= 90) return 'default.jpg';
|
||||
if (size <= 180) return 'mqdefault.jpg';
|
||||
if (size <= 360) return 'hqdefault.jpg';
|
||||
return 'maxresdefault.jpg';
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export const THUMBNAIL_SIZES = {
|
||||
small: 96,
|
||||
medium: 160,
|
||||
large: 320
|
||||
small: 128,
|
||||
medium: 192,
|
||||
large: 360
|
||||
} as const;
|
||||
|
||||
export type ThumbnailSize = keyof typeof THUMBNAIL_SIZES;
|
||||
|
||||
Reference in New Issue
Block a user