File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- export function imageBufferToBase64 ( buffer : Buffer , fileType : string ) {
2- return `data:image/${ fileType } ;base64, ${ buffer . toString ( "base64" ) } ` ;
3- }
4-
51export function getImageNameFromTsxPath ( path : string ) {
62 return path
73 . split ( "/" )
Original file line number Diff line number Diff line change 33 getAstroImageBase64 ,
44 type AssetImageConfig ,
55} from "@bearstudio/astro-assets-generation" ;
6- import { imageBufferToBase64 } from "@/generated-assets/image" ;
76import { BgImage } from "@/generated-assets/components/BgImage" ;
87import { COLORS } from "@/generated-assets/theme" ;
98import { getEventData } from "./_utils" ;
@@ -28,7 +27,7 @@ export default async function ({
2827 site ,
2928 ) . toString ( ) ;
3029
31- const qrCodeBuffer = await QRCode . toBuffer ( url , {
30+ const qrCodeBase64 = await QRCode . toDataURL ( url , {
3231 width : 880 ,
3332 margin : 1 ,
3433 color : {
@@ -37,8 +36,6 @@ export default async function ({
3736 } ,
3837 } ) ;
3938
40- const qrCodeBase64 = imageBufferToBase64 ( qrCodeBuffer , "png" ) ;
41-
4239 return (
4340 < Frame { ...config } >
4441 < BgImage src = { postCover } width = { config . width } height = { config . height } />
Original file line number Diff line number Diff line change 11import { Frame } from "@/generated-assets/components/Frame" ;
22import { type AssetImageConfig } from "@bearstudio/astro-assets-generation" ;
3- import { imageBufferToBase64 } from "@/generated-assets/image" ;
43import { COLORS } from "@/generated-assets/theme" ;
54import { getEventData } from "./_utils" ;
65import { lunalink } from "@bearstudio/lunalink" ;
@@ -24,7 +23,7 @@ export default async function ({
2423 site ,
2524 ) . toString ( ) ;
2625
27- const qrCodeBuffer = await QRCode . toBuffer ( url , {
26+ const qrCodeBase64 = await QRCode . toDataURL ( url , {
2827 width : 880 ,
2928 margin : 1 ,
3029 color : {
@@ -33,8 +32,6 @@ export default async function ({
3332 } ,
3433 } ) ;
3534
36- const qrCodeBase64 = imageBufferToBase64 ( qrCodeBuffer , "png" ) ;
37-
3835 return (
3936 < Frame { ...config } >
4037 < div
You can’t perform that action at this time.
0 commit comments