refactor(NavHeader.astro): ⚡ Optimise the header background image size and resolution
Moved to using Astro's `getImage()` function to serve the image as an avif image wich was been scaled down so it's isn't larger resolution than it need to be
This commit is contained in:
parent
9c8e5523c3
commit
8f5c40bed5
3 changed files with 9 additions and 4 deletions
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -2,6 +2,7 @@
|
||||||
"conventionalCommits.scopes": [
|
"conventionalCommits.scopes": [
|
||||||
"FriendLink.astro",
|
"FriendLink.astro",
|
||||||
"astro.config.mjs",
|
"astro.config.mjs",
|
||||||
".vscode"
|
".vscode",
|
||||||
|
"NavHeader.astro"
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -1,12 +1,16 @@
|
||||||
---
|
---
|
||||||
import { Picture } from "astro:assets";
|
import { Picture, getImage } from "astro:assets";
|
||||||
import pfp from "../img/sites/avatar.png";
|
import pfp from "../img/sites/avatar.png";
|
||||||
import Partition from "./Partition.astro";
|
import Partition from "./Partition.astro";
|
||||||
|
|
||||||
|
import myBackground from "../img/sites/avatar-ht-f.png"
|
||||||
|
|
||||||
|
const optimizedBackground = await getImage({src: myBackground, format: 'avif', quality: 40, width: 680})
|
||||||
---
|
---
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="rounded-2xl flex flex-col shadow-xl shadow-black py-8 mb-8 items-center backdrop-blur-3xl bg-center bg-[url('/static/img/sites/avatar-ht-f.webp')]"
|
style={`width: 670px; border: 1px solid var(--border); background-image: url('${optimizedBackground.src}');`}
|
||||||
style="width: 670px; border: 1px solid var(--border);"
|
class="rounded-2xl flex flex-col shadow-xl shadow-black py-8 mb-8 items-center bg-center bg-cover"
|
||||||
>
|
>
|
||||||
<Picture
|
<Picture
|
||||||
src={pfp}
|
src={pfp}
|
||||||
|
|
BIN
src/img/sites/avatar-ht-f.png
Normal file
BIN
src/img/sites/avatar-ht-f.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 713 KiB |
Loading…
Add table
Add a link
Reference in a new issue