{"id":13644016,"url":"https://github.com/fengyongge/imagepicker","last_synced_at":"2025-04-21T06:32:44.044Z","repository":{"id":101090368,"uuid":"64898722","full_name":"fengyongge/imagepicker","owner":"fengyongge","description":"imagepicker是一款用于在Android设备上获取照片（拍照或从相册、文件中选择）、压缩图片的开源工具库。","archived":false,"fork":false,"pushed_at":"2020-11-25T08:04:54.000Z","size":10885,"stargazers_count":282,"open_issues_count":1,"forks_count":59,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-05-22T06:12:16.265Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fengyongge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-08-04T03:20:56.000Z","updated_at":"2024-01-03T02:57:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"dcaaad28-fcbb-4166-8edf-a82aeb3aff44","html_url":"https://github.com/fengyongge/imagepicker","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fengyongge%2Fimagepicker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fengyongge%2Fimagepicker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fengyongge%2Fimagepicker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fengyongge%2Fimagepicker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fengyongge","download_url":"https://codeload.github.com/fengyongge/imagepicker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223823340,"owners_count":17208946,"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":[],"created_at":"2024-08-02T01:01:56.383Z","updated_at":"2024-11-09T16:30:53.443Z","avatar_url":"https://github.com/fengyongge.png","language":"Java","funding_links":[],"categories":["图片"],"sub_categories":[],"readme":"# imagepicker(图片选择器)\n\n![Bintray](https://img.shields.io/bintray/dt/917386389/androidlibs/imagepicker)[![Download](https://api.bintray.com/packages/917386389/androidlibs/imagepicker/images/download.svg) ](https://bintray.com/917386389/androidlibs/imagepicker/_latestVersion)[![License](https://img.shields.io/badge/license-Apache%202-green.svg)](https://www.apache.org/licenses/LICENSE-2.0)\n\n## 图片选择器简介\nimagepicker是一款用于在Android设备上获取照片（拍照或从相册、文件中选择）、压缩图片的开源工具库，目前最新版本[V1.4.5](https://github.com/fengyongge/imagepicker)。\n\n* 从相册里面选择图片或者拍照获取照片\n* 浏览选择的本地或者网络图片\n* 保存图片\n\n## 更新说明\n\n[更新日志](https://github.com/fengyongge/imagepicker/blob/master/readme/updateLog.md)\n\n\n## 如何引用\n* 配置gradle依赖\n```java\nimplementation 'com.zzti.fengyongge:imagepicker:1.4.5'\n```\n\n* 配置清单文件所需activity和provider权限\n```java\n\n   \u003c!-- 引入imagepicker时需要注册的activity 分别为预览图片和选择图片--\u003e\n        \u003cactivity android:name=\"com.zzti.fengyongge.imagepicker.PhotoPreviewActivity\" /\u003e\n        \u003cactivity android:name=\"com.zzti.fengyongge.imagepicker.PhotoSelectorActivity\" /\u003e\n\n```\n\n## 如何使用\n* 拍照或者从图库选择图片\n```java\n\n    //获取单例，调用下面方法即可，具体可参考源码sample\n     ImagePickerInstance.getInstance()\n\n  /**\n     * 对外图库选择图片,或者拍照选择图片方法\n     * @param context\n     * @param limit  选择图片张数\n     * @param isShowCamera 是否支持拍照\n     * @param requestCode\n     */\n    public void photoSelect(Context context, int limit, boolean isShowCamera,int requestCode) {\n        Intent intent = new Intent(context, PhotoSelectorActivity.class);\n        intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);\n        intent.putExtra(LIMIT, limit);\n        intent.putExtra(IS_SHOW_CAMERA, isShowCamera);\n        CommonUtils.launchActivityForResult((Activity) context, intent, requestCode);\n    }\n```\n* 获取拍照或者图片地址\n```java\n  \t@Override\n  \tpublic void onActivityResult(int requestCode, int resultCode, Intent data) {\n  \t\tswitch (requestCode) {\n  \t\tcase 0:\n\t\t\tif (data != null) {\n\t\t\t\tList\u003cString\u003e paths = (List\u003cString\u003e) data.getExtras().getSerializable(\"photos\");//path是选择拍照或者图片的地址数组\n\t\t\t\t//处理代码\n\n\t  \t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t\tsuper.onActivityResult(requestCode, resultCode, data);\n\t\t}\n```\n* 浏览图片\n```java\n\n  //获取单例，调用下面方法即可，具体可参考源码sample\n     ImagePickerInstance.getInstance()\n\n  /**\n     * 对外开放的图片预览方法\n     * @param context\n     * @param tempList 浏览图片集合，注意！必须封装成imagepicker的bean，url支持网络或者本地\n     * @param positon  角标\n     * @param isSave 是否支持保存\n     */\n    public void photoPreview(Context context, List\u003cPhotoModel\u003e tempList, int positon, boolean isSave) {\n        Bundle bundle = new Bundle();\n        bundle.putSerializable(PHOTOS, (ArrayList\u003cPhotoModel\u003e) tempList);\n        bundle.putInt(POSITION, positon);\n        bundle.putBoolean(IS_SAVE, isSave);\n        CommonUtils.launchActivity(context, PhotoPreviewActivity.class, bundle);\n    }\n\n\n```\n* 保存图片\n\n 网络图片点击保存时，默认保存到内存卡，imagepicker文件夹下\n\n## 实际效果\n![](https://raw.githubusercontent.com/917386389/imagepickerdemo/master/app/src/4.gif)\n\n\n\n## 关于作者\n```java\nLog.i(\"homepage\", \"http://fengyongge.github.io/\");\nLog.i(\"email\", \"fengyongge98@gmail.com\");\nLog.i(\"motto1\", \"可以让步，却不可以退缩，可以羞涩，却不可以软弱\");\nLog.i(\"motto2\", \"纸上得来终觉浅 绝知此事要躬行\");\n```\n\n## License\n```\nCopyright 2016 fengyongge\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffengyongge%2Fimagepicker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffengyongge%2Fimagepicker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffengyongge%2Fimagepicker/lists"}