# PixImagePicker **Repository Path**: chinasoft3_ohos/PixImagePicker ## Basic Information - **Project Name**: PixImagePicker - **Description**: PixImagePicker是一个拍照、录像,照片和视频选择功能库 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 7 - **Forks**: 2 - **Created**: 2021-05-25 - **Last Updated**: 2022-09-06 ## Categories & Tags **Categories**: harmonyos-selector, harmonyos-image **Tags**: None ## README # PixImagePicker #### 项目介绍 - 项目名称:PixImagePicker - 所属系列:openharmony的第三方组件适配移植 - 功能:PixImagePicker是一个拍照、录像,照片和视频选择功能库 - 项目移植状态:主功能完成 - 调用差异:无 - 开发版本:sdk6,DevEco Studio2.2 Beta1 - 基线版本:Release 1.6.2 #### 效果演示 ![效果演示](media/demo.gif) #### 安装教程 1.在项目根目录下的build.gradle文件中, ``` allprojects { repositories { maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' } maven { url 'https://s01.oss.sonatype.org/content/repositories/releases/' } } } ``` 2.在entry模块的build.gradle文件中, ``` dependencies { implementation('com.gitee.chinasoft_ohos:PixImagePicker:1.2.5') ...... } ``` 在sdk6,DevEco Studio2.2 Beta1下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下 #### 使用说明 ``` java Options options = Options.init() .setRequestCode(100) //Request code for ability results .setCount(3) //Number of images to restict selection count .setFrontfacing(false) //Front Facing camera on start .setPreSelectedUrls(returnValue) //Pre selected Image Urls .setSpanCount(4) //Span count for gallery min 1 & max 5 .setMode(Options.Mode.All) //Option to select only pictures or videos or both .setVideoDurationLimitinSeconds(30) //Duration for video recording .setScreenOrientation(AbilityInfo.DisplayOrientation.PORTRAIT) //Orientaion .setPath("/pix/images"); //Custom Path For media Storage Pix.start(MainAbility.this, options); ``` 或者直接使用最小配置去获取图片 ``` java Pix.start(MainAbility.this, Options.init().setRequestCode(100)); ``` 在onAbilityResult方法里获取返回的结果 ``` java @Override protected void onAbilityResult(int requestCode, int resultCode, Intent resultData) { super.onAbilityResult(requestCode, resultCode, resultData); if (requestCode == options.getRequestCode()) { ArrayList returnValue = resultData.getSequenceableArrayListParam(Pix.IMAGE_RESULTS); } } ``` #### 测试信息 CodeCheck代码测试无异常 CloudTest代码测试无异常 病毒安全检测通过 当前版本demo功能与原组件基本无差异 #### 版本迭代 - 1.2.5 - 0.0.1-SNAPSHOT #### 版权和许可信息 Licensed under the Apache License, Version 2.0, [click here for the full license](./LICENSE).