feat: move some stuff around

This commit is contained in:
2023-08-01 18:35:35 +02:00
parent c5cf629482
commit e51667bbac
9 changed files with 97 additions and 63 deletions

View File

@ -126,14 +126,20 @@ const GET = async (
console.log("[api/image] resized image", { imageUrl });
cache.setImage(modifiedImage, {
await cache.setImage(modifiedImage, {
url: imageUrl,
width: params.width,
height: params.height,
mediaType: remoteImage.mediaType,
});
return new Response(modifiedImage, {
const cachedImage = await cache.getImage({
url: imageUrl,
width: params.width,
height: params.height,
});
return new Response(cachedImage.data || modifiedImage, {
headers: {
"Content-Type": remoteImage.mediaType,
},