allow disproportionate memes
This commit is contained in:
+9
-12
@@ -19,32 +19,29 @@ export async function normalizeToWebp(buffer) {
|
||||
if (!metadata?.width || !metadata?.height) {
|
||||
throw new HttpError(400, 'Image could not be decoded.');
|
||||
}
|
||||
if (metadata.width !== metadata.height) {
|
||||
throw new HttpError(422, 'Image must be square.');
|
||||
}
|
||||
|
||||
const targetSize = Math.min(metadata.width, MAX_OUTPUT_DIMENSION);
|
||||
const output = await image
|
||||
.rotate()
|
||||
.resize(targetSize, targetSize, {
|
||||
fit: 'cover',
|
||||
.resize({
|
||||
width: MAX_OUTPUT_DIMENSION,
|
||||
height: MAX_OUTPUT_DIMENSION,
|
||||
fit: 'inside',
|
||||
withoutEnlargement: true
|
||||
})
|
||||
.webp({
|
||||
quality: WEBP_QUALITY,
|
||||
effort: 4
|
||||
})
|
||||
.toBuffer();
|
||||
.toBuffer({ resolveWithObject: true });
|
||||
|
||||
return {
|
||||
buffer: output,
|
||||
buffer: output.data,
|
||||
image: {
|
||||
format: 'webp',
|
||||
ext: 'webp',
|
||||
mime: 'image/webp',
|
||||
width: targetSize,
|
||||
height: targetSize,
|
||||
byteSize: output.length
|
||||
width: output.info.width,
|
||||
height: output.info.height,
|
||||
byteSize: output.data.length
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
const SITE_NAME = 'The Meme Protocol';
|
||||
const SITE_DESCRIPTION = 'A live, moderated meme stream for The Meme Protocol: square WebP memes, MEME_CONSENSUS_SCORE ranking, and community review.';
|
||||
const SITE_DESCRIPTION = 'A live, moderated meme stream for The Meme Protocol: WebP memes, MEME_CONSENSUS_SCORE ranking, and community review.';
|
||||
const REPO_URL = 'https://git.yoonect.com/Nautilus/bitsforfree';
|
||||
|
||||
export function publicBaseUrl(req) {
|
||||
@@ -76,7 +76,7 @@ export function llmsTxt(baseUrl) {
|
||||
return [
|
||||
'# The Meme Protocol',
|
||||
'',
|
||||
'> A live, moderated meme gallery. Uploads are square PNG/JPEG inputs normalized to metadata-stripped WebP, scored with MEME_CONSENSUS_SCORE, and published only after AI or admin approval.',
|
||||
'> A live, moderated meme gallery. Uploads are PNG/JPEG inputs normalized to metadata-stripped WebP, scored with MEME_CONSENSUS_SCORE, and published only after AI or admin approval.',
|
||||
'',
|
||||
'Important URLs:',
|
||||
`- Site: ${baseUrl}/`,
|
||||
|
||||
Reference in New Issue
Block a user