You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
545 B
JavaScript

import Jimp from 'jimp'
export default async function handler(req, res) {
const img = req.query.img
const baseURL = "https://orthoverse.io/api/img/"
return new Promise((resolve, reject) => {
console.log(baseURL + img)
Jimp.read(baseURL + img).then((image) => {
image.resize(166,166).getBuffer(Jimp.MIME_PNG, (err, buffer) => {
res.status(200).write(buffer)
resolve()
})
})
.catch(err => {
console.log(err)
res.status(404).json({ error: "Not found" })
resolve()
})
})
}