{"bugs":{"url":"https://github.com/raxjs/universal-api/issues"},"dist":{"shasum":"1fe90845b6e6cab54751dcecb7cc6dfa45ba8a5b","tarball":"https://registry.npmjs.org/@uni/image/-/image-1.0.5-beta.tgz","fileCount":102,"integrity":"sha512-SxKiqDt6j+f05HxfpS0OlqD9M6eXPWS45wUaqBVxIpOaeeKnSpq7htULkmaDKCUQiH0g6B/rvUUAHl8UwP4YUw==","signatures":[{"sig":"MEQCIDPkDyaZd0bs8rKjbE1+90FyuFPInJWCRwRzAKWlmbBMAiBW8pQmdxImcntnyC2Fxf8szRWg7XefuHP0NIzCGP1igA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":138889,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJguG+fCRA9TVsSAnZWagAA56kQAILValwXRBbwaTF1WRrb\nv4GVqCejYs6cwWhLa75W9zVtcX4K5ccE/cfDqRH6XIWYjbqydEpVgLEpbBkP\njuqzcKXPQCHZ+x56MSw7BJHdZcXqRym4t6PygdDAcSmH7xSh681gq2+P1Zvp\n5LoDUxg48BrO11podSacNseOcFnDLQDSt/MNuNwFshhzQ+XiNXDRewNcTFBQ\nHMKW2/O8ST14glYrqOqi3TzHCEMAv4JfU8q1UZlnf0GWMjb7UXqTZNusXtW6\nEKegUfkuTZ8gK4Wz3B2JOpMS9lWF1lxBP6R29C6A/sr951ZhSZ/ZPR9vapB9\nwvnDVmwwLFIfYyuUOHrsWVtVNE1gONA7EwguijeT/6jTyd577kMON1TQulQu\nNkfpOVJ3qlPu9se11Quv2sONeu3rS+llUgrgP8dhJoR50qKp4mNNwWmOR1xp\nNAhZfsJvdPm/1QMYIk+RCGX0jbIcx8mfQA6tTAtUbDzJCYMF5FgyUm3sctHh\nwgClLr8S6uAkQ7P2gZh7JHqTmfGrS/u3ywUXwPBzp+TGeNktLe1zUKRx32bg\nKGHnJP/C9S1kY0P9yRsM3wISOMWjbS6aotqIIYgFz7mMZzPVc5jv2JWr28tw\nDrMWu19nxcaoa5NEueGeEe5KJVe66VU8z6lZGJVvf1BFJ9uwO8m237MV6FNo\nL3C6\r\n=YAo7\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.5-beta_1622699935848_0.6322459967275786","host":"s3://npm-registry-packages"},"_id":"@uni/image@1.0.5-beta","version":"1.0.5-beta"}