Change song art to use Next's image

This commit is contained in:
Liam 2022-10-19 18:56:46 +01:00
parent 9f76e7c4e8
commit 2d9d019138
2 changed files with 3 additions and 2 deletions

@ -12,7 +12,7 @@ export default async function handler(req, res) {
const exists = fs.existsSync(imagePath); const exists = fs.existsSync(imagePath);
if (!exists) { if (!exists) {
const data = await fetch(`https://eu.cdn.beatsaver.com/${mapHash}.${ext}`); const data = await fetch(`https://eu.cdn.beatsaver.com/${mapHash}.${ext}`);
let buffer = await data.buffer(); let buffer = await data.buffer(); // Change to arrayBuffer at some point to make it shush
buffer = await sharp(buffer).resize(150, 150).toBuffer(); buffer = await sharp(buffer).resize(150, 150).toBuffer();
fs.writeFileSync(imagePath, buffer); fs.writeFileSync(imagePath, buffer);
res.setHeader("Content-Type", "image/" + ext); res.setHeader("Content-Type", "image/" + ext);

@ -1,3 +1,4 @@
import { Image } from "@nextui-org/react";
import { Component } from "react"; import { Component } from "react";
import styles from "../../styles/songInfo.module.css"; import styles from "../../styles/songInfo.module.css";
@ -64,7 +65,7 @@ export default class SongInfo extends Component {
return ( return (
<div className={styles.songInfoContainer}> <div className={styles.songInfoContainer}>
<img src={songArt} /> <Image alt="Song art-work" src={songArt} />
<div className={styles.songInfo}> <div className={styles.songInfo}>
<p className={styles.songInfoSongName}> <p className={styles.songInfoSongName}>
{songName.length > 35 {songName.length > 35