{"id":13644130,"url":"https://github.com/chengzichen/KrGallery","last_synced_at":"2025-04-21T06:33:11.822Z","repository":{"id":188155913,"uuid":"88827057","full_name":"chengzichen/KrGallery","owner":"chengzichen","description":"Crop , Video, Photos, from Telegram","archived":false,"fork":false,"pushed_at":"2018-08-07T04:09:38.000Z","size":17846,"stargazers_count":118,"open_issues_count":2,"forks_count":25,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-09T16:43:54.348Z","etag":null,"topics":["crop","galleryconfig","photos","telegram","video"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chengzichen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-04-20T06:04:26.000Z","updated_at":"2023-05-17T11:13:59.000Z","dependencies_parsed_at":"2023-08-14T03:33:56.389Z","dependency_job_id":null,"html_url":"https://github.com/chengzichen/KrGallery","commit_stats":null,"previous_names":["chengzichen/krgallery"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chengzichen%2FKrGallery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chengzichen%2FKrGallery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chengzichen%2FKrGallery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chengzichen%2FKrGallery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chengzichen","download_url":"https://codeload.github.com/chengzichen/KrGallery/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250008320,"owners_count":21359965,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crop","galleryconfig","photos","telegram","video"],"created_at":"2024-08-02T01:01:57.917Z","updated_at":"2025-04-21T06:33:06.811Z","avatar_url":"https://github.com/chengzichen.png","language":"Java","funding_links":[],"categories":["图片"],"sub_categories":[],"readme":"# KrGallery\n\nCrop , Video, Photos, from Telegram  \n\n一个集**拍照和选择图片,裁剪**,**录制视频和选择视频**的强大且流畅简洁的库。\n\n\nKrGallery摘取于[Telegram](https://github.com/DrKLO/Telegram \"https://github.com/DrKLO/Telegram\"),基于[@TelegramGallery](https://github.com/TangXiaoLv/TelegramGallery)开发,快速，高效，低耗,轻量级,使用简单。\n\n- [功能](#功能)\n- [效果](#效果)\n- [安装](#安装)\n- [用途](#用途)\n    - [选择图片](#选择图片)\n    - [拍照](#拍照)\n    - [获取图片](#获取图片)\n    - [录制视频](#录制视频)\n    - [选择视频](#选择视频)\n    - [获取视频](#获取视频)\n    - [注意](#注意)\n    - [API](#API说明)\n- [TODO](#TODO)   \n- [作者](#作者)\n- [感谢](#感谢)\n- [更变日志]()\n\n## 功能\n\n* 快速，高效，低耗\n* 简易的整合,轻量级\n* 基本没有依赖于任何的三方库\n* 集拍照,选择图片,裁剪,录制视频和选择视频为一体\n\n----------\n\n## 安装\n\n [![](https://jitpack.io/v/chengzichen/KrGallery.svg)](https://jitpack.io/#chengzichen/KrGallery) [ ![Download](https://api.bintray.com/packages/chengzichen/maven/gallerylib/images/download.svg) ](https://bintray.com/chengzichen/maven/gallerylib/_latestVersion)\n\n- 方式一:\n\n**Step 1.  在根目录的gradle文件中配置**\n\n\n**Add it in your root build.gradle at the end of repositories:**\n\n\n\tallprojects {\n\t\trepositories {\n\t\t\t...\n\t\t\tmaven { url 'https://jitpack.io' }\n\t\t}\n\t}\n\n\n**step2 添加依赖:**\n\n\tdependencies {\n\t     compile 'com.github.chengzichen:KrGallery:v1.03'\n\t}\n\n\n\n- 方式二:\n\n\n**Step 1.  在根目录的gradle文件中配置**\n\n\t\tallprojects {\n\t\t\t\trepositories {\n\t\t\t\t\t...\n\t\t\t\t\t jcenter()\n\t\t\t\t}\n\t\t\t}\n\n\n**step2 添加依赖:**\n\n\n\tdependencies {\n\t\t      compile 'com.dhc.krgallery:gallerylib:1.0.3'\n\t\t}\n\n\n\n----------\n\n\n## 效果\n![Image text](https://github.com/chengzichen/KrGallery/raw/master/gif/photos.gif)\n![Image text](https://github.com/chengzichen/KrGallery/raw/master/gif/selectcrop.gif)\n![Image text](https://github.com/chengzichen/KrGallery/raw/master/gif/photocrop.gif)\n![Image text](https://github.com/chengzichen/KrGallery/raw/master/gif/video.gif)\n\n## 用途\n\n### 选择图片\n\t\n- **单选**(type:GalleryConfig.SELECT_PHOTO)\n\t\n\t    GalleryHelper\n\t    .with(MainActivity.this)\t\t\t//Activity or Fragment\n\t    .type(GalleryConfig.SELECT_PHOTO)   //选择类型\n\t    .requestCode(12)\t\t\t\t\t//startResultActivity requestcode 自己定义\n\t    .singlePhoto()\t\t\t\t\t\t//选择单张图片\n\t    .execute();\n\n\n- **多选**(type:GalleryConfig.SELECT_PHOTO)\n\n\t    GalleryHelper\n\t    .with(MainActivity.this)\t\t\t//Activity or Fragment\n\t    .type(GalleryConfig.SELECT_PHOTO)\t//选择类型\n\t    .requestCode(12)\t\t\t\t\t//startResultActivity requestcode 自己定义\n\t    .limitPickPhoto(9)\t\t\t\t\t//图片选择张数\n\t    .execute();\n\n\n- **需要裁剪图片**\n\t\n \t\tString outputPath = StorageUtil.getWritePath(StorageUtil.get32UUID() + \".jpg\", StorageType.TYPE_TEMP);//定义裁剪图片输出在sdcard的位置\n\n        GalleryHelper\n\t\t.with(MainActivity.this)\t\t\t//Activity or Fragment\n\t\t.type(GalleryConfig.SELECT_PHOTO)   //选择类型\n\t\t.requestCode(12)\t\t\t\t\t//startResultActivity requestcode 自己定义\n\t\t.singlePhoto()\t\t\t\t\t\t//选择单张图片\n\t\t.isNeedCropWithPath(outputPath)\t\t//需要裁剪并输出图片的路径,没有传入时返回数据为byte[]\n\t\t.execute();\t\n\n\n\n### 拍照\n\t\t\n- 拍照\n\n\t\tGalleryHelper\n\t\t.with(MainActivity.this)   \t\t\t//Activity or Fragment\n\t\t.type(GalleryConfig.TAKE_PHOTO)\t\t//选择类型,拍照\n\t\t.requestCode(12)\t\t\t\t\t//startResultActivity requestcode 自己定义\n\t\t.execute();\t\n\t\n\t\n- 需要裁剪图片 \n\n\t\t outputPath = StorageUtil.getWritePath(StorageUtil.get32UUID() + \".jpg\", StorageType.TYPE_TEMP);\n         GalleryHelper\n\t\t.with(MainActivity.this)\t\t\t//Activity or Fragment\n\t\t.type(GalleryConfig.TAKE_PHOTO)\t\t//选择类型\n\t\t.isNeedCropWithPath(outputPath)\t\t//需要裁剪并输出图片的路径,没有传入时返回数据为byte[]\n\t\t.requestCode(12)\t\t\t\t\t//startResultActivity requestcode 自己定义\n\t\t.execute();\n\n\t**onActivityResult**\n\n\n### 获取图片\n\n\n\n\n\u003e **在Acitivity 或者Fragment 中onActivityResult 方法**\t\n\n\n \t\tString path = dataIntent.getStringExtra(GalleryActivity.PHOTOS);\n\n\n\u003e **注意  :  需要裁剪并输出图片的路径,没有传入时返回数据为byte[]**\n\n\n\n\t\tbyte[] datas =dataIntent.getByteArrayExtra(GalleryActivity.DATA);\n\n### 录制视频(可限制录制时间)\n\n\n\t\t GalleryHelper\n\t\t.with(MainActivity.this)    \t//Activity or Fragment\n\t\t.type(GalleryConfig.RECORD_VEDIO)//选择类型\n\t\t.requestCode(12)\t\t\t\t//startResultActivity requestcode 自己定义\n\t\t.limitRecordTime(10)            //定义录制视频时间\n\t\t.limitRecordSize(10)            //定义录制视频时间\n\t\t.execute();\n\t\t\n### 选择视频\n\t\t\n\t\t GalleryHelper\n\t\t.with(MainActivity.this)\t \t//Activity or Fragment\t\n\t\t.type(GalleryConfig.SELECT_VEDIO)//Activity or Fragment\t\n\t\t.requestCode(12)\t\t\t\t//startResultActivity requestcode 自己定义\n\t\t.isSingleVedio()\t\t\t\t//是否是单选视频\n\t\t.execute();\n\n\n### 获取视频\n\n\u003e **在Acitivity 或者Fragment 中onActivityResult 方法**\n\n\n  \t\tString path = data.getStringExtra(GalleryActivity.VIDEO);\n\n### 注意\n\n- **需要裁剪并输出图片的路径,没有传入时返回数据为byte[]**\n- **选取多张图片时裁剪只对第一张照片有效**\n- **选着视频目前支持单个视频**\n\n\n### API说明\n\t\n- 类[GalleryHelper](KrGallery/gallery/src/main/java/com/dhc/gallery/GalleryHelper.java) \n\t\n\t\t1. with()    \t\t\t\t\t\t\t\t\t\t//Activity or Fragment\n\t\t2. type(int type)  \n\t\t\t1.  GalleryConfig.SELECT_PHOTO  \t\t\t\t//选择图片\n\t\t\t2.  GalleryConfig.TAKE_PHOTO \t\t\t\t\t//拍照\n\t\t\t3.  GalleryConfig.RECORD_VEDIO\t\t\t\t\t//录制视频\n\t\t\t4.  GalleryConfig.SELECT_VEDIO\t\t\t\t\t//选择单个视频\n\t\t\t5.  GalleryConfig.TAKEPHOTO_RECORDVEDIO \t\t//拍照和录制视频\n\t\t3. requestCode(int code) \t\t\t\t \t\t\t//startResultActivity requestcode 自己定义\n\t\t4. isSingleVedio()    \t\t\t\t\t\t\t\t//选择单个视频,必须调用方法\n\t\t5. isNeedCropWithPath() \t\t\t\t\t\t\t//进行裁剪图片  返回一个传入路径值\n\t\t6. isNeedCrop()\t\t\t\t\t\t\t\t\t\t//需要裁剪图片 这将返回一个  byte[] data数据类型\n\t\t7. selectVedioWithMimeTypes()\t\t\t\t\t\t//filter of media type， based on MimeType standards：{http://www.w3school.com.cn/media/media_mimeref.asp}\u003cLi\u003eeg:new string[]{\"image/gif\",\"image/jpeg\"}\n\t\t8. hintOfPick()\t\t\t\t\t\t\t\t\t\t//hint of Toast when limit is reached\n\t\t9. singlePhoto()\t\t\t\t\t\t\t\t\t//选择单张照片\n\t\t10. limitPickPhoto(int)  \t\t\t\t\t\t\t//hint of Toast when limit is reached\n\t\t11. limitRecordTime(int)                            //限制视频录制的时间\n\t\t11. execute()\n\n\n## TODO\n\n- 修改部分样式 \n- 自定义主题\n- 视频的编辑\n- 图片的编辑\n- 提供压缩\n- 优化代码\n\n\n## 作者\n\n\n\n-  github: [@chengzichen](https://github.com/chengzichen)\n\n\n-  博客 : [邓浩宸的博客](https://chengzichen.github.io/)\n\n\n## 感谢 \n\n\n\n\u003e [@Telegram](https://github.com/DrKLO/Telegram \"https://github.com/DrKLO/Telegram\")\n\n\n\n\u003e [@TelegramGallery](https://github.com/TangXiaoLv/TelegramGallery)\n\n## 友情链接\n\n\n\n\u003e [@XDroid](https://github.com/limedroid) 老司机","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchengzichen%2FKrGallery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchengzichen%2FKrGallery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchengzichen%2FKrGallery/lists"}