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

image-drag-dropper

v1.0.2

Published

image-drag-dropper is a lightweight library designed to facilitate image drag and drop functionality

Downloads

14

Readme

Image Drag Dropper

image-drag-dropper is a lightweight library designed to facilitate image drag and drop functionality.

Cat Just assign an id to the HTML tags as shown above, and image-drag-dropper will handle the rest.

Installation

You can install image-drag-dropper via npm:

npm i image-drag-dropper

Usage

Import in your js

// Import your file uploader functionality
import initializeFileUploader from './node_modules/image-drag-dropper/src/index.js'

initializeFileUploader();

Create a Drop Area:

<div id="file-drop-area">
    <!-- Your drop area content goes here -->
</div>

Add a Hidden File Input:

<input type="file" id="file-input" multiple accept="image/*" class="d-none">

Display Dropped Image:

<img id="dropped-img">

##Example Here's a simple example demonstrating the usage of image-drag-dropper (with Bootstrap 5):

<div id="file-drop-area" class="border rounded d-flex justify-content-center align-items-center"
        style="width: 300px; height: 200px; cursor: pointer;">
        <div class="text-center">
            <svg class="text-primary" xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 24 24">
                <path fill="currentColor"
                    d="m19.21 12.04l-1.53-.11l-.3-1.5A5.484 5.484 0 0 0 12 6C9.94 6 8.08 7.14 7.12 8.96l-.5.95l-1.07.11A3.99 3.99 0 0 0 2 14c0 2.21 1.79 4 4 4h13c1.65 0 3-1.35 3-3c0-1.55-1.22-2.86-2.79-2.96m-5.76.96v3h-2.91v-3H8l4-4l4 4z"
                    opacity=".3" />
                <path fill="currentColor"
                    d="M19.35 10.04A7.49 7.49 0 0 0 12 4C9.11 4 6.6 5.64 5.35 8.04A5.994 5.994 0 0 0 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5c0-2.64-2.05-4.78-4.65-4.96M19 18H6c-2.21 0-4-1.79-4-4c0-2.05 1.53-3.76 3.56-3.97l1.07-.11l.5-.95A5.469 5.469 0 0 1 12 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5l1.53.11A2.98 2.98 0 0 1 22 15c0 1.65-1.35 3-3 3M8 13h2.55v3h2.9v-3H16l-4-4z" />
            </svg>

            <p class="mt-3 px-5">Drag and drop your image here or click to select a file.</p>
        </div>
    </div>
    <input type="file" id="file-input" multiple accept="image/*" class="d-none">


    <img id="dropped-img" style="width: 300px;" class="img-thumbnail">

With image-drag-dropper, incorporating image drag and drop functionality into your project becomes a seamless process, enhancing user interaction and experience.