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

angularjs-imageupload-directive-deluxe

v1.0.0

Published

Upload and resize images with AngularJS. Proof of Concept.

Downloads

1

Readme

Demo AngularJS imageupload Directive

Description

imageupload Directive for AngularJS

Usage

Please see the demo HTML for better and tested examples.

Features

  • Upload Image with FileReader
  • Resize Image via canvas
  • Make image cover certain size while maintaining its original height-width ratio
  • Choose cover origin ( left - center - right / top - center - bottom )
  • Send Image Data URL (base64) to whatever you want.
  • External Drag and Drop support

Single image

<button
    input-image
    ng-model="image"
    ng-change="uploadImage(image)">
</button>
<img ng-show="image" ng-src="{{image.url}}" type="{{image.file.type}}" />

The image object has the following properties:

  • file
  • url
  • dataURL

Single image with resizing

<button
    input-image
    append-data-uri
    resize
    resize-max-height="300"
    resize-max-width="250"
    resize-quality="0.7"
    ng-model="image">
</button>

<img ng-show="image" ng-src="{{image.dataURL}}" type="{{image.file.type}}"/>

The image object has the following properties:

  • file
  • url
  • dataURL
  • resized
    • dataURL
    • type

Multiple images with resizing

<button
    input-images
    append-data-uri
    append
    resize
    resize-max-height="300"
    resize-max-width="250"
    resize-quality="0.7"
    ng-model="images">
</button>

<p>Original</p>
<img ng-show="images" ng-src="{{images[0].dataURL}}" type="{{images[0].file.type}}"/>
<p>Resized</p>
<img ng-show="images" ng-src="{{images[0].resized.dataURL}}"/>

When used with multiple the image object is always an array of objects with the following properties:

  • file
  • url
  • dataURL
  • resized
    • dataURL
    • type

Single image with covering

<button
    input-image
    ng-model="image"
    append-data-uri
    cover
    cover-height="300"
    cover-width="100"
    cover-x="center"
    cover-y="bottom"
    resize-quality="0.7">
</button>

<p>Original</p>
<img ng-show="image" ng-src="{{image.dataURL}}" type="{{image.file.type}}"/>
<p>Resized</p>
<img ng-show="image" ng-src="{{image.resized.dataURL}}"/>

Optional Parameter:

  • resize-quality (default is 0.7)
  • resize-type (default is 'image/jpg')
  • resize-max-height (default is 300)
  • resize-max-width (default is 250)
  • cover
  • cover-height (default is 300)
  • cover-width (default is 250)
  • cover-x (default is 'left')
  • cover-y (default is 'top')
  • append (appends to model list as opposed to overwriting it)

How to run the Demo?

git clone https://github.com/boxxxie/angularjs-imageupload-directive.git
cd angularjs-imageupload-directive
npm install

node demo/back-end/app.js
open http://localhost:8080

Depends on

  • angular-1.2.15

Tested in following browsers:

Testimage: 4320x3240 4.22 MB, Resized (70% jpg): 320x270

  • Chrome 24 (Windows 8), Size: 9.3 KB
  • Chrome Canary 27 (Windows 8), Size: 9.3 KB
  • Firefox 18 (Windows 8), Size: 23.5 KB
  • Internet Explorer 10 (Windows 8), Size: 9.06 KB

Known Issues

  • current demo may not work correctly. please submit PR if you can fix it (may need a build script)
  • filesize can vary from Browser to Browser.

TODO's

  • better drag and drop support
  • make a build file and break up the main source file into smaller pieces.