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 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-sinoservices-telerik-imagepicker

v1.0.1

Published

Sinoservices developed plugin

Downloads

90

Readme

imagePicker插件,支持Android

参考cordova-plugin-telerik-imagepicker插件,进行修改。

一,安装插件

cordova plugin add cordova-plugin-sinoservices-telerik-imagepicker
npm install --save @ionic-native/image-picker

二,使用方法

import {ImagePicker} from "@ionic-native/image-picker/";

@Injectable()
export class NativeService {
  constructor(private imagePicker: ImagePicker) {

  }

  /**
   * 通过相册选择获取照片
   * @param maxCount 选择图片最大值,默认1。
   * @param destinationType 选择照片类型,默认1。照片base64字符串:0;照片路径:1。
   */
  getPictureByAlbum(maxCount: number = 1, destinationType: number = 1): Observable<any> {
    let that = this;

    let options = Object.assign({
      maximumImagesCount: maxCount,//选择图片的最大值
      destinationType: destinationType,//期望返回的图片格式
      width: Constants.IMAGE_SIZE,//缩放图像的宽度(像素)
      height: Constants.IMAGE_SIZE,//缩放图像的高度(像素)
      quality: Constants.QUALITY_SIZE//图像质量,范围为0 - 100
    });

    return Observable.create(observer => {
      that.imagePicker.getPictures(options).then(files => {
        console.log("imagePicker==获取图片");

        if (destinationType === 0) {//url路径
          observer.next(files);
        } else {
          let imgBase64s = [];//base64字符串数组
          for (let fileUrl of files) {//根据图片绝对路径转化为base64字符串
            that.convertImgToBase64(fileUrl).subscribe(base64 => {
              imgBase64s.push(base64);
              if (imgBase64s.length === files.length) {
                observer.next(imgBase64s);
              }
            })
          }
        }
      }).catch(err => {
        if (err == 20) {
          alert('没有权限,请在设置中开启权限');
          return;
        }
        alert(err);
        console.log('通过相册选择多图失败');
        // alert('获取照片失败');
      });
    });
  }
}