import Vnmf from '../../index' declare module '../../index' { namespace saveImageToPhotosAlbum { interface Option { /** Image File Path,Could be a temporary file path or permanent,Cannot initialise Evolution's mail component. */ filePath: string /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface calls a successful echo function */ success?: (res: VnmfGeneral.CallbackResult) => void } } namespace previewImage { interface Option { /** List of links to pictures that need be previewed。 */ urls: string[] /** Link to the current display of pictures */ current?: string /** @support weapp Minimum Version:2.13.0。Whether to show long press menus,Default value:true */ showmenu?: boolean /** @support weapp Minimum Version:2.13.0。origin: Send Fullreferrer; no-referrer: Do Not Send。Format Fixed As https://servicewechat.com/{appid}/{version}/page-frame.html,of which {appid} A small program. appid,{version} A version number for the applet,Version Number 0 _Other Organiser、Experiential and Audited Versions,Version Number devtools Name as Developer Tool,The rest is an official version;Default value:no-referrer */ referrerPolicy?: string /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface calls a successful echo function */ success?: (res: VnmfGeneral.CallbackResult) => void } } namespace previewMedia { interface Sources { /** Cannot initialise Evolution's mail component. */ url: string /** Type of resources(Picture or video),Default value:image */ type?: 'image' | 'video' /** Image of the cover video */ poster?: string } interface Option { /** List of resources to preview */ sources: Sources[] /** Resource number currently displayed,Default value:0 */ current?: number /** Whether to show long press menus 2.13.0,Default value:true */ showmenu?: boolean /** origin: Send Fullreferrer; no-referrer: Do Not Send。Format Fixed As https://servicewechat.com/{appid}/{version}/page-frame.html,of which {appid} A small program. appid,{version} A version number for the applet,Version Number 0 _Other Organiser、Experiential and Audited Versions,Version Number devtools Name as Developer Tool,The rest is an official version;Default value:no-referrer */ referrerPolicy?: string /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface calls a successful echo function */ success?: (res: VnmfGeneral.CallbackResult) => void } } namespace getImageInfo { interface Option { /** Path of the picture,It can be a relative path.、Temporary File Path、Storage file path、Network image path */ src: string /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface calls a successful echo function */ success?: (result: SuccessCallbackResult) => void } interface SuccessCallbackResult extends VnmfGeneral.CallbackResult { /** Image Original Height,Unitspx。Do Not Consider Rotation。 */ height: number /** [The device's in the direction of photograph.](http://sylvana.net/jpegcrop/exif_orientation.html) * @default "up" */ orientation: keyof Orientation /** Local Path to Pictures */ path: string /** Picture Format */ type: string /** Original Width of Pictures,Unitspx。Do Not Consider Rotation。 */ width: number /** Call Results */ errMsg: string } interface Orientation { /** Default Orientation(The cell phone took a photo.),Corresponding Exif Medium 1。or none orientation Information。 */ 'up' /** Same. up,But the mirror flipped.,Corresponding Exif Medium 2 */ 'up-mirrored' /** Rotate180degrees,Corresponding Exif Medium 3 */ 'down' /** Same. down,But the mirror flipped.,Corresponding Exif Medium 4 */ 'down-mirrored' /** Same. left,But the mirror flipped.,Corresponding Exif Medium 5 */ 'left-mirrored' /** Rotate Clockwise90degrees,Corresponding Exif Medium 6 */ 'right' /** Same. right,But the mirror flipped.,Corresponding Exif Medium 7 */ 'right-mirrored' /** Rotate Counterclockwise90degrees,Corresponding Exif Medium 8 */ 'left' } } namespace editImage { interface Option { /** Picture Path,Path of the picture,Support local paths、Package Path */ src: string /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface calls a successful echo function */ success?: (result: SuccessCallbackResult) => void } interface SuccessCallbackResult extends VnmfGeneral.CallbackResult { /** Temporary file path for edited pictures (Local Path) */ tempFilePath: string } } namespace chooseImage { interface Option { /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** The maximum number of photo lengths that can be selected */ count?: number /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** The size of the selected picture */ sizeType?: Array /** Select the source of picture */ sourceType?: Array /** Interface calls a successful echo function */ success?: (result: SuccessCallbackResult) => void /** It's for uploading.inputElementsID(Onlyh5End)@supported h5 */ imageId?: string } /** Size of the picture */ interface sizeType { /** Original */ original /** compressed */ compressed } /** Source of the picture */ interface sourceType { /** Selected Images from Albums */ album /** Use camera */ camera /** Use pre-cam(OnlyH5Pure Browser Use) */ user /** Use the back of camera(OnlyH5Pure Browser) */ environment } interface SuccessCallbackResult extends VnmfGeneral.CallbackResult { /** List of local temporary file paths for pictures */ tempFilePaths: string[] /** Local Temporary File List for Pictures */ tempFiles: ImageFile[] /** Call Results */ errMsg: string } /** Local Temporary File List for Pictures */ interface ImageFile { /** Local Temporary File Path */ path: string /** Local Temporary File Size,Units B */ size: number /** File MIME Type * @supported h5 */ type?: string /** Original Browser File Object * @supported h5 */ originalFileObj?: File } } namespace compressImage { interface Option { /** Picture Path,Path of the picture,It can be a relative path.、Temporary File Path、Storage file path */ src: string /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Compress mass,Scope0~100,The smaller the value,The lower the quality.,The higher the compression rate.(Just right.jpgValidity)。 */ quality?: number /** Interface calls a successful echo function */ success?: (result: SuccessCallbackResult) => void } interface SuccessCallbackResult extends VnmfGeneral.CallbackResult { /** Temporary file path for compressed pictures */ tempFilePath: string /** Call Results */ errMsg: string } } namespace chooseMessageFile { interface Option { /** Maximum number of files to select,Yeah. 0~100 */ count: number /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** Filter with file extension name,Only type==file _Other Organiser。None of them are empty strings.。Default does not filter。 */ extension?: string[] /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface calls a successful echo function */ success?: (result: SuccessCallbackResult) => void /** Type of selected file */ type?: keyof SelectType } interface SuccessCallbackResult extends VnmfGeneral.CallbackResult { /** Returns the local temporary file object array of selected */ tempFiles: ChooseFile[] /** Call Results */ errMsg: string } /** Returns the local temporary file object array of selected */ interface ChooseFile { /** The name of the selected file */ name: string /** Local Temporary File Path */ path: string /** Local Temporary File Size,Units B */ size: number /** Could not close temporary folder: %s,UnixTime stamp,The tool does not support this attribute for the time being */ time: number /** File type selected */ type: keyof SelectedType } interface SelectType { /** Select From All Files */ all /** Only video files can be selected */ video /** Only image files can be selected */ image /** You can select files other than pictures and videos. */ file } interface SelectedType { /** Could not close temporary folder: %s */ video /** Could not close temporary folder: %s */ image /** File selected with the exception of pictures and videos */ file } } namespace cropImage { interface Option { /** Picture Path,Path of the picture,Support local paths、Package Path */ src: string /** Crop Scale */ cropScale: keyof CropScale /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface calls a successful echo function */ success?: (result: SuccessCallbackResult) => void } interface SuccessCallbackResult extends VnmfGeneral.CallbackResult { /** Temporary file path for clipped pictures (Local Path) */ tempFilePath: string } interface CropScale { /** Width & As1By comparison1 */ '1:1' /** Width & As3By comparison4 */ '3:4' /** Width & As4By comparison3 */ '4:3' /** Width & As4By comparison5 */ '4:5' /** Width & As5By comparison4 */ '5:4' /** Width & As6By comparison19 */ '6:19' /** Width & As19By comparison6 */ '19:6' } } interface VnmfStatic { /** Save pictures to system albums。Yes.[User Permissions](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.writePhotosAlbum * @supported weapp, rn, alipay, swan, tt * @example * ```tsx * Vnmf.saveImageToPhotosAlbum({ * success: function (res) { } * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.saveImageToPhotosAlbum.html */ saveImageToPhotosAlbum(option: saveImageToPhotosAlbum.Option): Promise /** Preview pictures and videos。 * @supported weapp * @example * ```tsx * Vnmf.previewMedia({ * sources: [] * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewMedia.html */ previewMedia(option: previewMedia.Option): Promise /** Preview pictures fullscreen in new page。Users can save pictures during preview、Cannot initialise Evolution's mail component.。 * @supported weapp, h5, rn, alipay, swan, tt * @example * ```tsx * Vnmf.previewImage({ * current: '', // The name of the current imagehttpLink * urls: [] // Images to be previewedhttpLink List * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewImage.html */ previewImage(option: previewImage.Option): Promise /** Retrieve photo information。Network pictures need to be configured firstdownloadDomain name only takes effect.。 * @supported weapp, h5, rn, alipay, swan, tt * @example * ```tsx * Vnmf.getImageInfo({ * src: 'images/a.jpg', * success: function (res) { * console.log(res.width) * console.log(res.height) * } * }) * Vnmf.chooseImage({ * success: function (res) { * Vnmf.getImageInfo({ * src: res.tempFilePaths[0], * success: function (res) { * console.log(res.width) * console.log(res.height) * } * }) * } * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.getImageInfo.html */ getImageInfo(option: getImageInfo.Option): Promise /** Edit Picture Interface * @supported weapp * @example * ```tsx * Vnmf.editImage({ * src: '', // Picture Path * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.editImage.html */ editImage(option: editImage.Option): Promise /** Compress image interface,Optional compression mass * @supported weapp, rn, tt * @example * ```tsx * Vnmf.compressImage({ * src: '', // Picture Path * quality: 80 // Compress mass * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.compressImage.html */ compressImage(option: compressImage.Option): Promise /** Select a file from client session。 * @supported weapp * @example * ```tsx * Vnmf.chooseMessageFile({ * count: 10, * type: 'image', * success: function (res) { * // tempFilePathI can do it.imgLabel 'ssrcProperties Display Pictures * const tempFilePaths = res.tempFilePaths * } * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseMessageFile.html */ chooseMessageFile(option: chooseMessageFile.Option): Promise /** * Select a picture from local album or use camera to take。 * @supported weapp, h5, rn, alipay, swan, tt * @example * ```tsx * Vnmf.chooseImage({ * count: 1, // Default9 * sizeType: ['original', 'compressed'], // You can specify if it's the original or compressed.,Both, by default. * sourceType: ['album', 'camera'], // You can specify whether the source is album or camera.,Both, by default.,Yes.H5Browser-end support for use `user` and `environment`Assign back-and-back cameras, respectively * success: function (res) { * // Returns the local file path list of selected photo,tempFilePathI can do it.imgLabel 'ssrcProperties Display Pictures * var tempFilePaths = res.tempFilePaths * } * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html */ chooseImage(option: chooseImage.Option): Promise /** * Crop Image Interface * @supported weapp * @example * ```tsx * Vnmf.cropImage({ * src: '', // Picture Path * cropScale: '1:1', // Crop Scale * success: function (res) { * // Returns the local file path list of selected photo,tempFilePathI can do it.imgLabel 'ssrcProperties Display Pictures * var tempFilePaths = res.tempFilePaths * } * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.cropImage.html */ cropImage(option: cropImage.Option): Promise } }