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

@jonz94/capacitor-image-picker

v2.0.1

Published

Capacitor plugin for multiple image selection

Downloads

261

Readme

Install

npm install @jonz94/capacitor-image-picker
npx cap sync

iOS

Native Dependencies Setup

This plugin uses a forked version of YPImagePicker under the hood.

In order to use this plugin, you need to manually modified ios/App/Podfile as following:

target 'App' do
  capacitor_pods
  # Add your Pods here
+  pod 'YPImagePicker', :git => 'https://github.com/jonz94/YPImagePicker.git', :tag => '5.2.2.0'
end

After modified ios/App/Podfile, make sure to run pod update command to sync up the iOS project.

Permissions

iOS requires the following usage description be added and filled out for your app in Info.plist:

  • NSPhotoLibraryUsageDescription (Privacy - Photo Library Usage Description)

Read about Configuring Info.plist in the iOS Guide for more information on setting iOS permissions in Xcode.

Android

Native Dependencies Setup

This plugin uses a forked version of TedImagePicker under the hood.

Setup JitPack Repository

Add following line to your android/build.gradle:

allprojects {
    repositories {
        google()
        mavenCentral()
+        maven { url "https://jitpack.io" }
    }
}

Enable Data Binding

Add following lines to your android/app/build.gradle:

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    defaultConfig {
        // ...
    }
    buildTypes {
        // ...
    }
+    dataBinding {
+        enabled true
+    }
}

Sync Project

After modified android/build.gradle and android/app/build.gradle, make sure to run Sync Project with Gradle Files in Android Studio.

Permissions

This plugin requires the following permissions be added to your AndroidManifest.xml:

<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />

The storage permissions are for reading photo files.

Read about Setting Permissions in the Android Guide for more information on setting Android permissions.

Configuration

No configuration required for this plugin.

Usage

import { ImagePicker } from '@jonz94/capacitor-image-picker';

const pickSingleImage = async () => {
  const { images } = await ImagePicker.present();

  // console.log(images[0]);

  return images[0];
}

const pickMultipleImages = async () => {
  const { images } = await ImagePicker.present({ limit: 10 });

  // console.log(images);

  return images;
}

const pickMultipleImagesWithCustomText = async () => {
  const { images } = await ImagePicker.present({
    limit: 10,
    surpassLimitMessage: 'You cannot select more than %d images.',
    titleText: 'Pick a image',
    albumsTitleText: 'Chose an album',
    libraryTitleText: 'Click here to change library',
    cancelText: 'Go Back',
    doneText: 'OK',
  });

  // console.log(images);

  return images;
}

API

present(...)

present(options?: PresentOptions | undefined) => Promise<Images>

| Param | Type | | ------------- | --------------------------------------------------------- | | options | PresentOptions |

Returns: Promise<Images>


Interfaces

Images

| Prop | Type | Description | Since | | ------------ | -------------------- | ------------------------------- | ----- | | images | Image[] | Array of all the picked images. | 1.0.0 |

Image

| Prop | Type | Description | Since | | -------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------- | ----- | | path | string | The file path of the image. | 1.0.0 | | webPath | string | webPath returns a path that can be used to set the src attribute of an image for efficient loading and rendering. | 1.0.0 | | mimeType | string | The mime type of the image. | 1.0.0 |

PresentOptions

| Prop | Type | Description | Default | Since | | ------------------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------- | ----- | | limit | number | Maximum number of images the user will be able to choose. Note: If this is set to 1, upon selection of a single image. | 1 | 1.0.0 | | surpassLimitMessage | string | The message when user select more than maximum number of pictures. This message will not occur when limit is 1. Note: The message MUST INCLUDE ONE AND ONLY ONE %d as a placeholder for showing the value of limit. | "You can only select %d images." | 1.0.0 | | titleText | string | Android only: The title of the image picker. | "Select Image" | 1.0.0 | | albumAllText | string | Android only: name of the all photos album. | "All" | 1.2.0 | | libraryTitleText | string | iOS only: The title of the library. | "Library" | 1.0.0 | | albumsTitleText | string | iOS only: The title of the albums. | "Albums" | 1.0.0 | | cancelText | string | iOS only: The text to display on the cancel button. Note: on Android, the cancel button is shown as icon-only back button with no text. | "Cancel" | 1.0.0 | | doneText | string | The text to display on the done button. | "Done" | 1.0.0 |

Changelog

See CHANGELOG.md.

License

See LICENSE.

Credits