fix(dynozavry): serve hero banner from public PNG + raise media quality
- Copy original lossless PNG to public/images/locations/ as hero bg fallback (bypasses Payload WebP compression entirely when CMS has no image) - Fallback heroBgUrl to static PNG so the banner always renders - Raise Media collection WebP quality: 82→88 (mobile/tablet), 85→92 (original+desktop) Future re-uploads will have noticeably better quality Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ab820f7c99
commit
40ced357df
3 changed files with 7 additions and 5 deletions
BIN
public/images/locations/dino-hero-banner.png
Normal file
BIN
public/images/locations/dino-hero-banner.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
|
|
@ -80,8 +80,10 @@ export default async function DinosaurPage() {
|
|||
const bg = loc?.heroBackground
|
||||
if (bg && typeof bg !== 'number') heroBgUrl = (bg as Media).url ?? null
|
||||
} catch {
|
||||
// DB unavailable at build time — render with fallbacks; ISR will hydrate at runtime
|
||||
// DB unavailable at build time — ISR will hydrate at runtime
|
||||
}
|
||||
// Fall back to static PNG (lossless, no Payload compression) when CMS has no image
|
||||
heroBgUrl = heroBgUrl ?? '/images/locations/dino-hero-banner.png'
|
||||
|
||||
const features = data.heroFeatures?.map((f) => f.text).filter(Boolean) as string[] | undefined
|
||||
|
||||
|
|
|
|||
|
|
@ -12,26 +12,26 @@ export const Media: CollectionConfig = {
|
|||
name: 'mobile',
|
||||
width: 640,
|
||||
height: undefined,
|
||||
formatOptions: { format: 'webp', options: { quality: 82 } },
|
||||
formatOptions: { format: 'webp', options: { quality: 88 } },
|
||||
},
|
||||
// Планшет / картки (до 1200px)
|
||||
{
|
||||
name: 'tablet',
|
||||
width: 1200,
|
||||
height: undefined,
|
||||
formatOptions: { format: 'webp', options: { quality: 82 } },
|
||||
formatOptions: { format: 'webp', options: { quality: 88 } },
|
||||
},
|
||||
// Десктоп / hero (до 1920px)
|
||||
{
|
||||
name: 'desktop',
|
||||
width: 1920,
|
||||
height: undefined,
|
||||
formatOptions: { format: 'webp', options: { quality: 82 } },
|
||||
formatOptions: { format: 'webp', options: { quality: 92 } },
|
||||
},
|
||||
],
|
||||
adminThumbnail: ({ doc }) => (doc.sizes?.tablet?.url ?? doc.url) as string,
|
||||
// Конвертуємо оригінал у WebP при завантаженні
|
||||
formatOptions: { format: 'webp', options: { quality: 85 } },
|
||||
formatOptions: { format: 'webp', options: { quality: 92 } },
|
||||
resizeOptions: { width: 1920, withoutEnlargement: true },
|
||||
},
|
||||
admin: {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue