npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cordova-ohos/cordova-plugin-imagepicker

v1.2.2

Published

Cordova imagepicker Plugin

Downloads

117

Readme

cordova-plugin-imagepicker 图片选择插件

一款功能强大的 Cordova 图片选择插件,支持从设备相册中批量选择图片、预览图片、限制选择数量及尺寸筛选等功能,适配 Android 、 iOS和 OHOS 三平台,为混合式移动应用提供高效的图片选择解决方案。

功能特性

  • 批量选择:支持一次性选择多张图片,可自定义最大选择数量

  • 图片预览:选择前可预览图片缩略图及原图,提升用户体验

  • 尺寸筛选:可根据图片宽度、高度筛选符合要求的图片

  • 格式支持:兼容 JPG、PNG 等主流图片格式,适配不同拍摄场景

  • 权限管理:自动处理相册访问权限申请,提供权限拒绝回调

  • 返回信息丰富:返回图片路径、尺寸、大小等完整元数据

安装方法

确保已创建 Cordova 项目(若未创建,执行 cordova create imagePickerDemo com.example.imagepicker ImagePickerDemo 创建),然后通过以下方式安装插件:

1. 基础安装(从 npm 仓库)

# 安装hcordova
npm install -g hcordova

# 安装稳定版插件
hcordova plugin add cordova-plugin-telerik-imagepicker

2. 安装指定版本


# 安装 1.0.0 版本
hcordova plugin add [email protected] --platform ohos

3. 从 GitCode 安装开发版


hcordova plugin add https://gitcode.com/OpenHamrony-Cordova/cordova-plugin-telerik-imagepicker.git --platform ohos

卸载方法

进入项目根目录,执行以下命令卸载插件:

# 全平台卸载
hcordova plugin remove cordova-plugin-telerik-imagepicker

#指定OHOS卸载
hcordova plugin remove cordova-plugin-telerik-imagepicker --platform ohos

平台配置

插件安装后需根据目标平台进行必要配置,以确保权限申请和功能正常运行。

核心 API

插件通过全局对象 window.imagePicker 暴露所有接口,所有方法均为异步执行,通过成功回调和错误回调处理结果。

选择多张照片

检查应用是否已获取相册访问权限。


 window.imagePicker.getPictures(
    function (results) {
        if (results.length <= 0) {
            return;
        }
        var src = "";
        for (var i = 0; i < results.length; i++) {
            src += "<img src='https://localhost" + results[i] + "' width='100%' />"
        }
        document.getElementById("imgInfo").innerHTML = src;
    }, function (error) {
        console.log('Error: ' + error);
    }, {
        maximumImagesCount: 9,
        width: 800
    }
);

许可证

本插件采用 Apache License 2.0 开源许可证。

参考资源