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

arts-hologram-image-upload

v2.7.19

Published

React image uploader with dropzone and cropper function

Downloads

39

Readme

Hologram Image Upload

React image uploader with dropzone and cropper function, which used React Dropzone and React Image Crop.

You can please feel free to open issues or pull request.

npm

Demo

https://hologram.sardo.work/

Features

  • Using dropzone to upload multiple image files
  • Crop and preview image

Browser Support

  • Latest Firefox
  • Latest Chrome
  • IE 11 and Edge

Installation

npm install hologram-image-upload --save

Usage

import Hologram from 'hologram-image-upload';

After version 2.5, you will not need require any css file now.

Props

defaultFiles (optional)

Mockup images of dropzone. You could pass the name, url, and type of file, then it will be add to dropzone when Hologram mounted.

<Hologram defaultFiles={[{name: 'dummy.jpg', url: 'https://s3-ap-southeast-1.amazonaws.com/dummy/dummy.jpg', type: 'image/jpeg'}]}/>

uploader (optional)

The post url of your upload handler. You need to pass this prop or a custom upload function for everything to work.

<Hologram uploader="upload.php"/>

maxFiles (optional)

If files more than this number, it will not be uploaded. However, if number is -1, user will be allow to upload unlimited number of image. Default Number is -1.

var maxFiles = 10;
<Hologram uploader="upload.php" maxFiles={maxFiles}/>

Custom Upload Function (optional)

If you want, you can pass in your custom upload function as a prop. The function takes two arguments: The file information and the actual file data. This function MUST return a promise

myUploadFunc(file, data) {
  return new Promise((resolve, reject) => {
    // FANCY TASKS HERE
    // do this and this and this
    // END OF FANCY TASKS
    request.post(FANCY_URL).send(MY_FANCY_DATA).end((err, res) =>{
      if (err) return reject(err)
      resolve(res)
    });
  });
}

<Hologram uploadFunction={this.myUploadFunc.bind(this)} ></Hologram>

dropzoneConfig (optional)

Config of React Dropzone. https://github.com/okonet/react-dropzone

var dropzoneConfig = {
            style : {
                textAlign: 'center',
                padding: '2.5em 0',
                background: 'rgba(0,0,0,0.5)',
                color: '#fff'
            }
    }

<Hologram uploader="upload.php" dropzoneConfig={dropzoneConfig}/>

cropperConfig (optional)

Config of React Image Crop. https://github.com/DominicTobias/react-image-crop

var crop = {
	x: 20,
	y: 10,
}

<Hologram uploader="upload.php" cropperConfig={crop} />

onComplete(result) (optional)

Callback function which trigger when image uploaded. It will pass a object which contain http response, you can use it to handler the result of upload.

Contributing

You can clone this repository then start develop at sandbox, or feel free to open issue on github.

Build package:

npm run build

Watch package change and build it:

npm run watch