File tree Expand file tree Collapse file tree 2 files changed +22
-6
lines changed
Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -13,14 +13,22 @@ export const size = {
1313export const contentType = 'image/png'
1414
1515export default async function Image ( ) {
16- // Read images from filesystem during build
17- const backgroundImageData = readFileSync (
16+ // Read images from filesystem during build and convert to ArrayBuffer
17+ const backgroundImageBuffer = readFileSync (
1818 join ( process . cwd ( ) , 'public' , 'images' , 'background.jpg' )
1919 )
20+ const backgroundImageData = backgroundImageBuffer . buffer . slice (
21+ backgroundImageBuffer . byteOffset ,
22+ backgroundImageBuffer . byteOffset + backgroundImageBuffer . byteLength
23+ )
2024
21- const profileImageData = readFileSync (
25+ const profileImageBuffer = readFileSync (
2226 join ( process . cwd ( ) , 'public' , 'images' , 'profile.jpg' )
2327 )
28+ const profileImageData = profileImageBuffer . buffer . slice (
29+ profileImageBuffer . byteOffset ,
30+ profileImageBuffer . byteOffset + profileImageBuffer . byteLength
31+ )
2432
2533 return new ImageResponse (
2634 (
Original file line number Diff line number Diff line change @@ -13,14 +13,22 @@ export const size = {
1313export const contentType = 'image/png'
1414
1515export default async function Image ( ) {
16- // Read images from filesystem during build
17- const backgroundImageData = readFileSync (
16+ // Read images from filesystem during build and convert to ArrayBuffer
17+ const backgroundImageBuffer = readFileSync (
1818 join ( process . cwd ( ) , 'public' , 'images' , 'background.jpg' )
1919 )
20+ const backgroundImageData = backgroundImageBuffer . buffer . slice (
21+ backgroundImageBuffer . byteOffset ,
22+ backgroundImageBuffer . byteOffset + backgroundImageBuffer . byteLength
23+ )
2024
21- const profileImageData = readFileSync (
25+ const profileImageBuffer = readFileSync (
2226 join ( process . cwd ( ) , 'public' , 'images' , 'profile.jpg' )
2327 )
28+ const profileImageData = profileImageBuffer . buffer . slice (
29+ profileImageBuffer . byteOffset ,
30+ profileImageBuffer . byteOffset + profileImageBuffer . byteLength
31+ )
2432
2533 return new ImageResponse (
2634 (
You can’t perform that action at this time.
0 commit comments