81 lines
2.3 KiB
TypeScript
81 lines
2.3 KiB
TypeScript
export type Rect = {
|
||
x: number;
|
||
y: number;
|
||
w: number;
|
||
h: number;
|
||
};
|
||
/**
|
||
*
|
||
* @param url 需要转为图片的链接
|
||
* @returns 图片的 dom
|
||
*/
|
||
export declare const urlToImg: (url: string) => Promise<HTMLImageElement>;
|
||
export declare const base64DecodeImageKey: (base64ImgKey: string) => string;
|
||
/**
|
||
* 通过url获取图片的base64字符串
|
||
* @param src 图片链接
|
||
* @param outputFormat 图片格式
|
||
* @returns base64 @string
|
||
*/
|
||
export declare const getBase64ByUrl: (src: string | URL, outputFormat?: string) => Promise<unknown>;
|
||
/**
|
||
* 把文件转base64
|
||
* @param file @file 文件
|
||
* @returns @string
|
||
*/
|
||
export declare const fileToBase64: (file: any) => Promise<string>;
|
||
/**
|
||
*
|
||
* @param image @file 图片文件
|
||
* @param width @number 宽度
|
||
* @param height @number 高度
|
||
* @returns @string base64
|
||
*/
|
||
export declare const getBase64Image: (image: any, width?: any, height?: any) => string;
|
||
/**
|
||
* 通过图片获取base64
|
||
* @param src 图片地址
|
||
* @returns @string
|
||
*/
|
||
export declare const getBase64ByImage: (src: string) => Promise<unknown>;
|
||
/**
|
||
* url转base64
|
||
* @param {String} url - url地址
|
||
*/
|
||
export declare const urlToBase64V2: (url: string) => Promise<unknown>;
|
||
/**
|
||
* base64转Blob
|
||
* @param {String} base64 - base64
|
||
*/
|
||
export declare function base64toBlob(base64: string): Blob | undefined;
|
||
/**
|
||
* 图片集打包压缩下载
|
||
* 1. url -> base64 -> blob
|
||
* 2. 将blob加入jsZip文件夹内,用file-saver保存
|
||
* @param {Array<{url:string,name:string}>} imgDataList
|
||
* @param {string} zipName
|
||
*/
|
||
export declare const downloadPackageImages: (imgDataList: string | any[], zipName: string) => Promise<void>;
|
||
export declare function getFileSize(size: number): string;
|
||
export declare const dataURLToBlob: (dataurl: string) => Blob;
|
||
/**
|
||
* key 转 http 链接
|
||
* @param originImgkey 图片的值 ,可以是 base64 也可以是 http链接
|
||
* @param host 图片的域值
|
||
* @returns {string}
|
||
*/
|
||
export declare const generateImg: (imgKey: string, host?: string) => string;
|
||
/**
|
||
* 获取指定字符串后面的部分
|
||
* @param imageKey v1_开头的字符串
|
||
* @returns
|
||
*/
|
||
export declare const getImageKey: (imageKey: string, preFix?: string) => string;
|
||
/**
|
||
* 获取图片
|
||
* @param img 图片的url链接
|
||
* @param odRect
|
||
* @returns file
|
||
*/
|
||
export declare const getFileByRect: (img: string, odRect: Rect) => Promise<File>;
|