{"bugs":{"url":"https://github.com/raxjs/universal-api/issues"},"dist":{"shasum":"cf2bbd4ee550260cdec4970ae2568d209bd89091","tarball":"https://registry.npmjs.org/@uni/image/-/image-1.0.4-beta.tgz","fileCount":100,"integrity":"sha512-7yLRPjFX/d0i3Y1bzYzpBVhbY8SabcBkquHDENtU3gILRRnbbHtuS/j8lujWd7lKne2GUMwBC2IwHOiKI3b+RA==","signatures":[{"sig":"MEQCIFanZiFcKlOQxB+nFVxjBRsYmfmKGHhP5gAVmzHmf2C4AiAcVbBjLcvi+CbU1eC2+8Kkgn7YL3pGkpSjLL9eF1xFdQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":118300,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgpMP1CRA9TVsSAnZWagAAACEP/3mfqLt57S3hTZrsCa8Z\nj/j5NvA5BkWh7vJpbytiVW8SqYvmTuL9o3wCCqWNgt6ljoZl4nJORhyDNbGy\nYOuV476dzkYyDsEeRrvKWbSVsNsfVSObOJEVSyp4EphQ/DoNjRtZz6jf6uMc\nlvKWzI+8r79rsRqU36FHBxN6TI6wgXp2+Q9trAOZePi+aHE4BRjZbVFxb8Zv\nxshK057lPna/jPoncnxAq4vM51ZEPThJ+t5aRWzICkAlSGjea+mHb9G4+5P1\ntBLr3ZWsWioQoSEqsnmSbaFm70VfMZstXgXLQw7iBg95mWcpnrHlsw1J8CNP\nIuJkvYEAqRWgWaXlFqscSDOiitc6qG/xvOGkULvSkJKHcskTtpO8gA+gRHux\nImpz41HHoGkuAJQNMoG9KJZsCX6ZtJYP36+jiIZnEazo21+r1D4590VmjQnM\nv9WZGJp9KdbMjPVnbkuJIHvjgojhI+q9gpoa5EXOgpwGPsWjh7wDvF/wICxk\n3yOItHwcp4sItLdj60zAw9CvKI7BiplfTydCPtMFX/0CmCBsCS8a1/C/vwsJ\nd13h3+7tJIHMoBdGNnDK8jLemaleJHsMISmmUHJd2qYOsWG5d4IZ6mNqzLQw\nK2Qu8YpkGe78vFLqKdFDD5YL6fWaYFLyZUD61f7bJbLEnEMNm5iwlLZuTny1\nNuZ1\r\n=Xw0C\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","name":"@uni/image","unpkg":"dist/index.js","author":{"name":"rax"},"module":"es/index.js","readme":"# @uni/image\n\n[![npm](https://img.shields.io/npm/v/@uni/apis.svg)](https://www.npmjs.com/package/@uni/apis) [![npm](https://img.shields.io/npm/v/@uni/image.svg)](https://www.npmjs.com/package/@uni/image)\n\n## Install\n\n```bash\n$ npm install @uni/image --save\n```\nor\n```bash\n$ npm install @uni/apis --save\n```\n\n# chooseImage \n\nSelects an image from the local album or takes a photo with the camera.\n\n## Supported\n\n<img alt=\"browser\" src=\"https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"h5\" /> <img alt=\"miniApp\" src=\"https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"ali miniprogram\" /> <img alt=\"wechatMiniprogram\" src=\"https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"wechatMiniprogram\"> <img alt=\"bytedanceMicroApp\" src=\"https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"bytedanceMicroApp\">\n\n## Usage\n\n```javascript\nimport { chooseImage } from '@uni/image';\n\nchooseImage({\n  count: 1,\n  sourceType: ['album', 'camera'],\n  success (res) {\n    const tempFilePaths = res.tempFilePaths\n  }\n});\n\n// promise\nchooseImage({\n  count: 1,\n  sourceType: ['album', 'camera']\n}).then(res => {\n  const tempFilePaths = res.tempFilePaths\n});\n\n```\n\nYou can also import from the big package：\n```js\nimport { image } from '@uni/apis';\n\nimage.chooseImage({\n  count: 1,\n  sourceType: ['album', 'camera'],\n  success (res) {\n    const tempFilePaths = res.tempFilePaths\n  }\n});\n\n// promise\nimage.chooseImage({\n  count: 1,\n  sourceType: ['album', 'camera']\n}).then(res => {\n  const tempFilePaths = res.tempFilePaths\n});\n```\n\n## Methods\n\n### `chooseImage(options)`\n\n#### Arguments\n\n| Property | Type | Description | required | Default |\n| --- | --- | --- | --- | --- |\n| options | `object`  |  | ✘ | - |\n| opthons.count | `number` | The maximum number of images allowed | ✘ | 1 |\n| opthons.sourceType | `Array<string>`  | The source of the image | ✘ | ['album', 'camera'] |\n| options.success | `Function`  | The callback function for a successful API call | ✘ | - |\n| options.fail | `Function`  | The callback function for a failed API call | ✘ | - |\n| options.complete | `Function`  | The callback function used when the API call completed (always executed whether the call succeeds or fails) | ✘ | - |\n\n#### Special Arguments\n\n| Property | Type | Description | required | Default | Supported |\n| --- | --- | --- | --- | --- | -- |\n| options.sizeType | `Array.<string>`  | The size of the select image | ✘ | ['original', 'compressed'] | <img alt=\"miniApp\" src=\"https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"ali miniprogram\" /> <img alt=\"wechatMiniprogram\" src=\"https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"wechatMiniprogram\"> |\n\n#### Return\n\n| Property | Type | Description |\n| --- | --- | --- |\n| tempFilePaths | `Array<string>`  | The list of local temporary file paths to images |\n| tempFiles | `Array<Object>` | The local temporary file list for images |\n\n##### res.tempFiles\n\n| Property | Type | Description |\n| --- | --- | --- |\n| path | `string`  | The path to the local temporary file |\n| size | `number`  | The size of a local temporary file, in bytes |\n\n# compressImage \n\nCompresses images. Multiple types of compression quality are available.\n\n## Supported\n\n<img alt=\"miniApp\" src=\"https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"ali miniprogram\" /> <img alt=\"wechatMiniprogram\" src=\"https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"wechatMiniprogram\"> <img alt=\"bytedanceMicroApp\" src=\"https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"bytedanceMicroApp\">\n\n## Usage\n\n```javascript\nimport { compressImage } from '@uni/image';\n\ncompressImage({\n  src: 'http://img.icon.com/a.png',\n  quality: 1,\n  success: (res) => {\n    console.log('success', res);\n  },\n  fail: (res) => {\n    console.log('fail', res);\n  },\n  complete: (res) => {\n    console.log('complete', res);\n  }\n});\n\n// promise\ncompressImage({\n  src: 'http://img.icon.com/a.png',\n  quality: 1\n}).then(response => {})\n  .catch(error => {})\n  .finally(res => {});\n\n```\n\n\nYou can also import from the big package：\n```js\nimport { image } from '@uni/apis';\n\nimage.compressImage({\n  src: 'http://img.icon.com/a.png',\n  quality: 1,\n  success: (res) => {\n    console.log('success', res);\n  },\n  fail: (res) => {\n    console.log('fail', res);\n  },\n  complete: (res) => {\n    console.log('complete', res);\n  }\n});\n\n// promise\nimage.compressImage({\n  src: 'http://img.icon.com/a.png',\n  quality: 1\n}).then(response => {})\n  .catch(error => {})\n  .finally(res => {});\n\n```\n\n## Methods\n\n### `compressImage(options)`\n\n#### Arguments\n\n| Property | Type | Description | required | Default |\n| --- | --- | --- | --- | --- |\n| options | `object`  |  | ✔️ | - |\n| opthons.src | `string`  | The path to the image. It can be a relative path, a temporary file path, or a file compress-image path | ✔️ |  - |\n| options.quality | `number`  | Compression quality. The value range is 0-3. | ✘ | - |\n| options.success | `Function`  | The callback function for a successful API call | ✘ | - |\n| options.fail | `Function`  | The callback function for a failed API call | ✘ | - |\n| options.complete | `Function`  | The callback function used when the API call completed (always executed whether the call succeeds or fails) | ✘ | - |\n\n#### Return\n\n| Property | Type | Description |\n| --- | --- | --- |\n| tempFilePath | `string` | The temporary file path to the compressed image |\n\n# getImageInfo \n\nObtains image information. For network images, it only takes effect when the download domain name is configured.\n\n## Supported\n\n<img alt=\"miniApp\" src=\"https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"ali miniprogram\" /> <img alt=\"wechatMiniprogram\" src=\"https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"wechatMiniprogram\"> <img alt=\"bytedanceMicroApp\" src=\"https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"bytedanceMicroApp\">\n\n## Usage\n\n```javascript\nimport { getImageInfo } from '@uni/image';\n\ngetImageInfo({\n  src: 'http://img.icon.com/a.png',\n  success: (res) => {\n    console.log('success', res);\n  },\n  fail: (res) => {\n    console.log('fail', res);\n  },\n  complete: (res) => {\n    console.log('complete', res);\n  }\n});\n\n// promise\ngetImageInfo({\n  src: 'http://img.icon.com/a.png'\n}).then(response => {})\n  .catch(error => {})\n  .finally(res => {});\n\n```\n\nYou can also import from the big package：\n```js\nimport { image } from '@uni/apis';\n\nimage.getImageInfo({\n  src: 'http://img.icon.com/a.png',\n  success: (res) => {\n    console.log('success', res);\n  },\n  fail: (res) => {\n    console.log('fail', res);\n  },\n  complete: (res) => {\n    console.log('complete', res);\n  }\n});\n\n// promise\nimage.getImageInfo({\n  src: 'http://img.icon.com/a.png'\n}).then(response => {})\n  .catch(error => {})\n  .finally(res => {});\n\n```\n\n## Methods\n\n### `getImageInfo(options)`\n\n#### Arguments\n\n| Property | Type | Description | required | Default |\n| --- | --- | --- | --- | --- |\n| options | `object`  |  | ✔️ | - |\n| opthons.src | `string`  | The path to the image. It can be a relative path or a path to a network image. | ✔️ |  - |\n| options.success | `Function`  | The callback function for a successful API call | ✘ | - |\n| options.fail | `Function`  | The callback function for a failed API call | ✘ | - |\n| options.complete | `Function`  | The callback function used when the API call completed (always executed whether the call succeeds or fails) | ✘ | - |\n\n#### Return\n\n| Property | Type | Description |\n| --- | --- | --- |\n| width | `number`  | The original width of the image (in px). |\n| height | `number`  | The original height of the image (in px).  |\n| path | `number`  | The local path to the image\t\t|\n\n#### Special Return\n\n| Property | Type | Description | Supported |\n| --- | --- | --- | --- |\n| orientation | `string`  | Device orientation when taking photos | <img alt=\"miniApp\" src=\"https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"ali miniprogram\" /> <img alt=\"wechatMiniprogram\" src=\"https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"wechatMiniprogram\"> |\n| type | `string`  | Image format\t| <img alt=\"miniApp\" src=\"https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"ali miniprogram\" /> <img alt=\"wechatMiniprogram\" src=\"https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"wechatMiniprogram\"> <img alt=\"bytedanceMicroApp\" src=\"https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"bytedanceMicroApp\"> no Dingding |\n\n##### orientation\n\n| Value | Description |\n| --- | --- |\n| up\t| Default orientation (landscape) |\n| up-mirrored\t| Mirrored orientation of up |\n| down | Rotates the device 180 degrees |\n| down-mirrored\t| Mirrored orientation of down |\n| left-mirrored |\tMirrored orientation of left |\n| right | Rotates the device 90 degrees clockwise |\n| right-mirrored | Mirrored orientation of right |\n| left | Rotates the device 90 degrees counterclockwise |\n\n# previewImage \n\nPreviews the image in full screen on a new page. You can save or send it to others while preview.\n\n## Supported\n\n<img alt=\"browser\" src=\"https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"h5\" /> <img alt=\"miniApp\" src=\"https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"ali miniprogram\" /> <img alt=\"wechatMiniprogram\" src=\"https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"wechatMiniprogram\"> <img alt=\"bytedanceMicroApp\" src=\"https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"bytedanceMicroApp\">\n\n## Usage\n\n```javascript\nimport { previewImage } from '@uni/image';\n\npreviewImage({\n  urls: ['url1', 'url2'],\n  current: 1,\n});\n\n```\n\nYou can also import from the big package：\n```js\nimport { image } from '@uni/apis';\n\nimage.previewImage({\n  urls: ['url1', 'url2'],\n  current: 1,\n});\n\n```\n\n## Methods\n\n### `previewImage(options)`\n\n#### Arguments\n\n| Property | Type | Description | required | Default |\n| --- | --- | --- | --- | --- |\n| options | `object`  |  | ✘ | - |\n| opthons.urls | `Array<string>` | The URLs of images to preview | ✘ |  |\n| opthons.current | `number`  | The index of the current image in urls list | ✘ | 0 |\n| options.success | `Function`  | The callback function for a successful API call | ✘ | - |\n| options.fail | `Function`  | The callback function for a failed API call | ✘ | - |\n| options.complete | `Function`  | The callback function used when the API call completed (always executed whether the call succeeds or fails) | ✘ | - |\n\n#### Special Arguments\n\n| Property | Type | Description | required | Default | Supported |\n| --- | --- | --- | --- | --- | -- |\n| options.showmenu | `boolean`  | show longpress menu | ✘ | true | <img alt=\"wechatMiniprogram\" src=\"https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"wechatMiniprogram\"> 2.13.0 |\n\n# saveImage \n\nSaves images to the system album.\n\n## Supported\n\n<img alt=\"miniApp\" src=\"https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"ali miniprogram\" /> <img alt=\"wechatMiniprogram\" src=\"https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"wechatMiniprogram\"> <img alt=\"bytedanceMicroApp\" src=\"https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"bytedanceMicroApp\">\n\n## Usage\n\n```javascript\nimport { saveImage } from '@uni/image';\n\nsaveImage({\n  url: 'http://img.icon.com/a.png',\n});\n\n```\n\nYou can also import from the big package：\n```js\nimport { image } from '@uni/apis';\n\nimage.saveImage({\n  url: 'http://img.icon.com/a.png',\n});\n\n```\n\n## Methods\n\n### `saveImage(options)`\n\n#### Arguments\n\n| Property | Type | Description | required | Default |\n| --- | --- | --- | --- | --- |\n| options | `object`  |  | ✔️ | - |\n| opthons.url | `string`  | The path to the image file. It can be a temporary or permanent file path. The path to a network image is not supported | ✔️ |  - |\n| options.success | `Function`  | The callback function for a successful API call | ✘ | - |\n| options.fail | `Function`  | The callback function for a failed API call | ✘ | - |\n| options.complete | `Function`  | The callback function used when the API call completed (always executed whether the call succeeds or fails) | ✘ | - |\n\n#### Special Arguments\n\n| Property | Type | Description | required | Default | Supported |\n| --- | --- | --- | --- | --- | -- |\n| options.showActionSheet | `boolean`  | show operation menus for image | ✘ | true |<img alt=\"miniApp\" src=\"https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg\" width=\"25px\" height=\"25px\" title=\"ali miniprogram\" /> |\n","exports":{".":{"web":"./es/web/index.js","default":"./es/index.js","miniapp":"./es/ali-miniapp/index.js","bytedance-microapp":"./es/bytedance-microapp/index.js","wechat-miniprogram":"./es/wechat-miniprogram/index.js"},"./*":"./*"},"license":"BSD-3-Clause","typings":"types/index.d.ts","_npmUser":{"name":"bunko","email":"2leg@immaster.cn"},"homepage":"https://github.com/raxjs/universal-api#readme","repository":{"url":"git+ssh://git@github.com/raxjs/universal-api.git","type":"git"},"_npmVersion":"6.14.5","description":"[![npm](https://img.shields.io/npm/v/@uni/apis.svg)](https://www.npmjs.com/package/@uni/apis) [![npm](https://img.shields.io/npm/v/@uni/image.svg)](https://www.npmjs.com/package/@uni/image)","directories":{},"maintainers":[{"name":"rax-publisher","email":"rax-public@alibaba-inc.com"},{"name":"bunko","email":"2leg@immaster.cn"}],"sideEffects":false,"_nodeVersion":"14.4.0","dependencies":{"@uni/env":"^1.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.en-US.md","_npmOperationalInternal":{"tmp":"tmp/image_1.0.4-beta_1621410804557_0.4538625367231508","host":"s3://npm-registry-packages"},"_id":"@uni/image@1.0.4-beta","version":"1.0.4-beta"}