This commit is contained in:
seb
2026-10-10 02:14:03 +02:00
parent 906ebafbbe
commit cf1c8d1126
11 changed files with 12 additions and 12 deletions

View File

@@ -32,7 +32,7 @@ Adds a child article to a parent article (creates and attaches with auto-generat
*Source: `src/store/article/addImage.js`*
Adds an image to an article by its SKU, processing full, thumb, and 40px-edge small-thumb AVIF variants.
Adds an image to an article by its SKU, processing full, thumb, and 32px-edge small-thumb AVIF variants.
**Parameters**

View File

@@ -6,7 +6,7 @@ This document is auto-generated from the JSDoc comments in `src/store` by runnin
*Source: `src/store/brand/addImage.js`*
Adds an image to a brand, processing full, thumb, and 40px-edge small-thumb AVIF variants.
Adds an image to a brand, processing full, thumb, and 32px-edge small-thumb AVIF variants.
**Parameters**
@@ -94,7 +94,7 @@ Lists the brands of the user's selected company, sorted by name.
| `[opts]` | `object` | Optional pagination options. |
| `[opts.offset=0]` | `number` | Number of brands to skip. |
| `[opts.limit=10]` | `number` | Number of brands to return (max 100). |
| `[opts.includeSmallThumbs=false]` | `boolean` | Include 40px-edge small thumbnail dimensions and base64 AVIF data. |
| `[opts.includeSmallThumbs=false]` | `boolean` | Include 32px-edge small thumbnail dimensions and base64 AVIF data. |
| `[tx]` | `object` | Optional transaction to run within. |
**Returns**

View File

@@ -6,7 +6,7 @@ This document is auto-generated from the JSDoc comments in `src/store` by runnin
*Source: `src/store/category/addImage.js`*
Adds an image to a category, processing full, thumb, and 40px-edge small-thumb AVIF variants.
Adds an image to a category, processing full, thumb, and 32px-edge small-thumb AVIF variants.
**Parameters**

View File

@@ -35,7 +35,7 @@ const image = await store.pic.getImageByHash(42, 'abc123');
*Source: `src/store/pic/getSmallThumbByHash.js`*
Returns the small thumbnail image (AVIF, 40px max edge) for a given hash.
Returns the small thumbnail image (AVIF, 32px max edge) for a given hash.
**Parameters**

View File

@@ -28,7 +28,7 @@ async function runTests() {
assert(existsSync(join(storageDir, 'fullbinary')), 'fullbinary dir should exist');
assert(existsSync(join(storageDir, 'thumbbinary')), 'thumbbinary dir should exist');
// Large file and image blobs stay on disk; the 40px small-thumb stays inline in pic.
// Large file and image blobs stay on disk; the 32px small-thumb stays inline in pic.
const fileTableInfo = provider.db.pragma('table_info("file")');
const fileColNames = fileTableInfo.map((c) => c.name);
console.log('file table columns:', fileColNames);

View File

@@ -22,7 +22,7 @@ export default function addImage(provider) {
const addArticlePicSql = isSqlite ? SQLITE_ADD_ARTICLEPIC : MSSQL_ADD_ARTICLEPIC;
/**
* Adds an image to an article by its SKU, processing full, thumb, and 40px-edge small-thumb AVIF variants.
* Adds an image to an article by its SKU, processing full, thumb, and 32px-edge small-thumb AVIF variants.
*
* @param {number} googleAuthId - The id of the Google auth user.
* @param {string} sku - The article SKU.

View File

@@ -22,7 +22,7 @@ export default function addImage(provider) {
const addBrandPicSql = isSqlite ? SQLITE_ADD_BRANDPIC : MSSQL_ADD_BRANDPIC;
/**
* Adds an image to a brand, processing full, thumb, and 40px-edge small-thumb AVIF variants.
* Adds an image to a brand, processing full, thumb, and 32px-edge small-thumb AVIF variants.
*
* @param {number} googleAuthId - The id of the Google auth user.
* @param {number} brandId - The id of the brand.

View File

@@ -46,7 +46,7 @@ export default function list(provider) {
* @param {object} [opts] - Optional pagination options.
* @param {number} [opts.offset=0] - Number of brands to skip.
* @param {number} [opts.limit=10] - Number of brands to return (max 100).
* @param {boolean} [opts.includeSmallThumbs=false] - Include 40px-edge small thumbnail dimensions and base64 AVIF data.
* @param {boolean} [opts.includeSmallThumbs=false] - Include 32px-edge small thumbnail dimensions and base64 AVIF data.
* @param {object} [tx] - Optional transaction to run within.
* @returns {Promise<{brands: Array<{id: number, name: string, gsprpinfo: string|null, pics: Array<{fullHash: string, thumbW: number, thumbH: number, thumbHash: string, smallThumbW?: number|null, smallThumbH?: number|null, smallThumbBinary?: string|null}>}>, total: number, offset: number, limit: number}>} The brands plus the total unpaged count. Small-thumbnail fields are present only when `includeSmallThumbs` is true; the binary is base64-encoded AVIF data.
*

View File

@@ -22,7 +22,7 @@ export default function addImage(provider) {
const addCategoryPicSql = isSqlite ? SQLITE_ADD_CATEGORYPIC : MSSQL_ADD_CATEGORYPIC;
/**
* Adds an image to a category, processing full, thumb, and 40px-edge small-thumb AVIF variants.
* Adds an image to a category, processing full, thumb, and 32px-edge small-thumb AVIF variants.
*
* @param {number} googleAuthId - The id of the Google auth user.
* @param {number} categoryId - The id of the category.

View File

@@ -8,7 +8,7 @@ export default function getSmallThumbByHash(provider) {
const sql = provider?.dialect === 'sqlite3' ? SQLITE_GET : MSSQL_GET;
/**
* Returns the small thumbnail image (AVIF, 40px max edge) for a given hash.
* Returns the small thumbnail image (AVIF, 32px max edge) for a given hash.
*
* @param {number} googleAuthId - The id of the Google auth user.
* @param {string} fullHash - The full image hash.

View File

@@ -3,7 +3,7 @@ import { rgbaToThumbHash } from 'thumbhash';
const FULL_MAX = 1000;
const THUMB_MAX = 200;
const SMALL_THUMB_MAX = 40;
const SMALL_THUMB_MAX = 32;
export default async function processAvifImage(inputBuffer) {
const input = Buffer.isBuffer(inputBuffer)