u
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user