u
This commit is contained in:
@@ -32,7 +32,7 @@ Adds a child article to a parent article (creates and attaches with auto-generat
|
|||||||
|
|
||||||
*Source: `src/store/article/addImage.js`*
|
*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**
|
**Parameters**
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ This document is auto-generated from the JSDoc comments in `src/store` by runnin
|
|||||||
|
|
||||||
*Source: `src/store/brand/addImage.js`*
|
*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**
|
**Parameters**
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ Lists the brands of the user's selected company, sorted by name.
|
|||||||
| `[opts]` | `object` | Optional pagination options. |
|
| `[opts]` | `object` | Optional pagination options. |
|
||||||
| `[opts.offset=0]` | `number` | Number of brands to skip. |
|
| `[opts.offset=0]` | `number` | Number of brands to skip. |
|
||||||
| `[opts.limit=10]` | `number` | Number of brands to return (max 100). |
|
| `[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. |
|
| `[tx]` | `object` | Optional transaction to run within. |
|
||||||
|
|
||||||
**Returns**
|
**Returns**
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ This document is auto-generated from the JSDoc comments in `src/store` by runnin
|
|||||||
|
|
||||||
*Source: `src/store/category/addImage.js`*
|
*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**
|
**Parameters**
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ const image = await store.pic.getImageByHash(42, 'abc123');
|
|||||||
|
|
||||||
*Source: `src/store/pic/getSmallThumbByHash.js`*
|
*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**
|
**Parameters**
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ async function runTests() {
|
|||||||
assert(existsSync(join(storageDir, 'fullbinary')), 'fullbinary dir should exist');
|
assert(existsSync(join(storageDir, 'fullbinary')), 'fullbinary dir should exist');
|
||||||
assert(existsSync(join(storageDir, 'thumbbinary')), 'thumbbinary 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 fileTableInfo = provider.db.pragma('table_info("file")');
|
||||||
const fileColNames = fileTableInfo.map((c) => c.name);
|
const fileColNames = fileTableInfo.map((c) => c.name);
|
||||||
console.log('file table columns:', fileColNames);
|
console.log('file table columns:', fileColNames);
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export default function addImage(provider) {
|
|||||||
const addArticlePicSql = isSqlite ? SQLITE_ADD_ARTICLEPIC : MSSQL_ADD_ARTICLEPIC;
|
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 {number} googleAuthId - The id of the Google auth user.
|
||||||
* @param {string} sku - The article SKU.
|
* @param {string} sku - The article SKU.
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export default function addImage(provider) {
|
|||||||
const addBrandPicSql = isSqlite ? SQLITE_ADD_BRANDPIC : MSSQL_ADD_BRANDPIC;
|
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} googleAuthId - The id of the Google auth user.
|
||||||
* @param {number} brandId - The id of the brand.
|
* @param {number} brandId - The id of the brand.
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export default function list(provider) {
|
|||||||
* @param {object} [opts] - Optional pagination options.
|
* @param {object} [opts] - Optional pagination options.
|
||||||
* @param {number} [opts.offset=0] - Number of brands to skip.
|
* @param {number} [opts.offset=0] - Number of brands to skip.
|
||||||
* @param {number} [opts.limit=10] - Number of brands to return (max 100).
|
* @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.
|
* @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.
|
* @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.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export default function addImage(provider) {
|
|||||||
const addCategoryPicSql = isSqlite ? SQLITE_ADD_CATEGORYPIC : MSSQL_ADD_CATEGORYPIC;
|
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} googleAuthId - The id of the Google auth user.
|
||||||
* @param {number} categoryId - The id of the category.
|
* @param {number} categoryId - The id of the category.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export default function getSmallThumbByHash(provider) {
|
|||||||
const sql = provider?.dialect === 'sqlite3' ? SQLITE_GET : MSSQL_GET;
|
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 {number} googleAuthId - The id of the Google auth user.
|
||||||
* @param {string} fullHash - The full image hash.
|
* @param {string} fullHash - The full image hash.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { rgbaToThumbHash } from 'thumbhash';
|
|||||||
|
|
||||||
const FULL_MAX = 1000;
|
const FULL_MAX = 1000;
|
||||||
const THUMB_MAX = 200;
|
const THUMB_MAX = 200;
|
||||||
const SMALL_THUMB_MAX = 40;
|
const SMALL_THUMB_MAX = 32;
|
||||||
|
|
||||||
export default async function processAvifImage(inputBuffer) {
|
export default async function processAvifImage(inputBuffer) {
|
||||||
const input = Buffer.isBuffer(inputBuffer)
|
const input = Buffer.isBuffer(inputBuffer)
|
||||||
|
|||||||
Reference in New Issue
Block a user