Page MenuHomeSealhub

imageRouter.ts
No OneTemporary

imageRouter.ts

import sharp from "sharp";
import { DirectCropOptions, SmartCropOptions } from "../utils/smartCropImage";
export type CropDescription = SmartCropOptions | DirectCropOptions | false;
export type BaseImageParameters = {
alt: string;
lossless: boolean;
lazy: boolean;
imgStyle: string;
style: string;
targetRatio: number;
ratioDiffThreshold: number;
crop: CropDescription;
thumbnailSize: number;
};
type sizesAttr = {
sizesAttr: string;
};
export type Container = {
objectFit?: "cover" | "contain";
width: number;
height: number;
};
type resolutions = {
resolutions: number[];
};
export type ImageParameters = (Partial<BaseImageParameters> &
(
| (sizesAttr & resolutions)
| sizesAttr
| (resolutions & { container: Container })
| { container: Container }
)) & { alt: string };
export type Task = {
hash: string;
resolution: number;
fileExtension: string;
crop: SmartCropOptions | DirectCropOptions | undefined;
};
export type correctExtension = "jpeg" | "png" | "avif" | "webp";
export type ImageData = {
resolutions: number[];
lossless: boolean;
originalPath: string;
targetRatio: number;
ratioDiffThreshold: number;
container: Container;
crop: CropDescription;
thumbnailSize: number;
};
export type ImageRatioClass =
| "horizontal"
| "vertical"
| "square"
| "landscape"
| "portrait"
| "ratio-crossed-threshold"
| "ratio-above-threshold"
| "ratio-below-threshold";

File Metadata

Mime Type
text/x-java
Expires
Sat, Oct 11, 09:31 (8 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
982407
Default Alt Text
imageRouter.ts (1 KB)

Event Timeline