更新记录
1.0.2(2024-07-01)
返回所选择图片的元数据: 拍照时间, 更改时间 如果是相机拍照,返回更多信息: 例如拍照时地址经纬度 图片来源类型
1.0(2024-06-20)
插件发布
平台兼容性
Android | iOS |
---|---|
× | 适用版本区间:11 - 17 |
原生插件通用使用流程:
- 购买插件,选择该插件绑定的项目。
- 在HBuilderX里找到项目,在manifest的app原生插件配置中勾选模块,如需要填写参数则参考插件作者的文档添加。
- 根据插件作者的提供的文档开发代码,在代码中引用插件,调用插件功能。
- 打包自定义基座,选择插件,得到自定义基座,然后运行时选择自定义基座,进行log输出测试。
- 开发完毕后正式云打包
付费原生插件目前不支持离线打包。
Android 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/android
iOS 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/ios
注意事项:使用HBuilderX2.7.14以下版本,如果同一插件且同一appid下购买并绑定了多个包名,提交云打包界面提示包名绑定不一致时,需要在HBuilderX项目中manifest.json->“App原生插件配置”->”云端插件“列表中删除该插件重新选择
mphl-educationcertification Demo
1:调用方式
var photoPickerModule = uni.requireNativePlugin("mphl-photopicker");
2:参数格式与解释
//json格式参数,
var res = {
}
3:方法调用
photoPickerModule.selectPhotos({test:1},(result)=>{
//回调逻辑自定义
console.log(result);
});
4:结果回调
json格式,{ "status": "1", "photo_list": [ { "height": "2532.000000", "width": "1170.000000", "img_size": "6706266", "img_url": "file:///private/var/mobile/Containers/Shared/AppGroup/3A47A09A-7C21-401A-BB5E-AFE210617E6F/File%20Provider%20Storage/photospicker/version=1&uuid=3E04C92F-A8AC-408E-A61D-1425A6F2B2D7&mode=compatible&noloc=0.png" "img_base64": "file:///var/mobile/Containers/Data/Application/6BDCE95A-9973-4758-AD92-08A781BFC0F9/Documents/8264A5AB-1855-4F2C-8BB7-C4AA620CC01E_test.png", "img_type": "png", "attributes": { "NSFileOwnerAccountID": 501, "NSFileSystemFileNumber": 166957029, "NSFileExtensionHidden": false, "NSFileSystemNumber": 16777222, "NSFileSize": 1087789, "NSFileGroupOwnerAccountID": 501, "NSFileOwnerAccountName": "mobile", "NSFileCreationDate": "2024-06-27T07:34:02.305Z", "NSFilePosixPermissions": 420, "NSFileProtectionKey": "NSFileProtectionCompleteUntilFirstUserAuthentication", "NSFileType": "NSFileTypeRegular", "NSFileGroupOwnerAccountName": "mobile", "NSFileReferenceCount": 1, "NSFileModificationDate": "2024-06-27T07:34:02.306Z" }, "metadata": { "{TIFF}": { "DateTime": "2024:06:2706:05:47", "ResolutionUnit": 2, "Orientation": 1, "XResolution": 72, "YResolution": 72 }, "{Exif}": { "SubsecTimeDigitized": "267", "PixelXDimension": 1080, "DateTimeDigitized": "2024:06:2706:05:47", "SceneCaptureType": 0, "OffsetTimeDigitized": "+08:00", "OffsetTime": "+08:00", "SubsecTimeOriginal": "267", "DateTimeOriginal": "2024:06:2706:05:47", "PixelYDimension": 2400, "SubsecTime": "267", "ColorSpace": 65535, "OffsetTimeOriginal": "+08:00", "ExifVersion": [ 2, 2, 1 ], "ComponentsConfiguration": [ 1, 2, 3, 0 ], "FlashPixVersion": [ 1, 0 ] }, "Depth": 8, "PixelHeight": 2400, "PixelWidth": 1080, "{JFIF}": { "XDensity": 72, "YDensity": 72, "JFIFVersion": [ 1, 0, 1 ], "DensityUnit": 0 }, "ProfileName": "DisplayP3", "DPIWidth": 72, "DPIHeight": 72, "ColorModel": "RGB", "Orientation": 1, "{IPTC}": { "DigitalCreationTime": "060547", "DigitalCreationDate": "20240627", "DateCreated": "20240627", "TimeCreated": "060547" } } } ] } status:状态码 photo_list:图片列表 height:图片高 width:图片宽度 img_size:图片大小(字节) img_url:图片手机上地址 img_base64:图片数据的base64编码 img_type:图片类型 attributes:沙盒中图片的属性 metadata:所选择图片的元数据