fix(meta): remove thumbhash placeholder generation

This commit is contained in:
DIYgod 2025-12-15 14:01:05 +08:00
parent fd3fdb1c08
commit 2b0ea6519a
No known key found for this signature in database
3 changed files with 2 additions and 23 deletions

View File

@ -21,13 +21,10 @@ Returns JSON:
```json
{
"width": <number>,
"height": <number>,
"thumbHash": "<base64>"
"height": <number>
}
```
- `thumbHash` is a [ThumbHash](https://github.com/evanw/thumbhash) placeholder that can be rendered on the client for a quick preview.
## Local Development
```bash

View File

@ -6,7 +6,6 @@ import type { ImageFormat } from './lib/detect-format'
import { resolveDimensions } from './lib/dimensions'
import { FetchImageError, fetchRemoteImageThroughProxy } from './lib/image-proxy-client'
import { decodeImage, encodeImage, resizeImage } from './lib/image-processor'
import { generateThumbHash } from './lib/thumbhash'
type Bindings = {
IMAGE_PROXY: Fetcher
@ -210,18 +209,10 @@ app.get('/meta/', async (c) => {
return c.json({ error: 'Failed to decode source image' }, 422)
}
let thumbHash: string | null = null
try {
thumbHash = await generateThumbHash(decoded)
} catch (error) {
console.error('Failed to generate thumbhash', error)
}
c.header('Cache-Control', 'public, max-age=31536000')
return c.json({
width: decoded.width,
height: decoded.height,
thumbHash
height: decoded.height
})
})

View File

@ -19,7 +19,6 @@ import {
encodeImage,
resizeImage,
} from "@/lib/image-processor.ts";
import { generateThumbHash } from "@/lib/thumbhash.ts";
const app = new Hono();
@ -233,18 +232,10 @@ const metaHandler = async (c: Context) => {
return c.json({ error: "Failed to decode source image." }, 422);
}
let thumbHash: string | null = null;
try {
thumbHash = await generateThumbHash(decoded);
} catch (error) {
console.error("Failed to generate thumbhash", error);
}
c.header("Cache-Control", CACHE_HEADER_VALUE);
return c.json({
width: decoded.width,
height: decoded.height,
thumbHash,
});
};