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 🙏

© 2025 – Pkg Stats / Ryan Hefner

angular-images-resizer

v2.0.3

Published

Resize images client-side is now possible with this angular module

Downloads

128

Readme

Angular-image-resizer

Build Status Coverage Status devDependency Status

This is a simple angular service which resizes images client-side. With this component, you will liberate some resources on your server! Let your client work for you, and save bandwidth. If you don't care about supporting every browsers then this component is for you.

You can test this module on this site example: http://fberthelot.github.io/angular-images-resizer/

Breaking changes in the 2.0.0 version

In this version the resizeService.resizeImage function return a promise. No need to use a callback anymore.

Get started

Add this module to your project with bower or npm:

bower install angular-images-resizer
npm install angular-images-resizer

Add the component to your app:

angular.module('app', ['images-resizer']); 

Then simply add the service to your code and start resizing your images :

angular.module('app', function ($document, $log, $scope, resizeService) {
  resizeService
    .resizeImage('resources/imageToResize', {
        size: 100, 
        sizeScale: 'ko'
        // Other options ...
    })
    .then(function(image){    
      // Add the resized image into the body
      var imageResized = document.createElement('img');
      imageResized.src = image;
      $document[0].querySelector('body').appendChild(imageResized);
    })
    .catch($log.error); // Always catch a promise :)

Availables functions

Click here to see the Full documentation

resizeImage

This is the main function of this service. The function take 3 argument, the src of the image, the options to resize the image and the callback. The src can be an base 64image.

Options
  • height: desired height of the resized image
  • width: desired width of the resized image
  • size: desired size of the resized image (Size are by default in Octet)
  • sizeScale: 'o' || 'ko' || 'mo' || 'go'
  • step: number of step to resize the image, by default 3. Bigger the number, better is the final image. Bigger the number, bigger the time to resize is.
  • outputFormat: specify the image type. Default value is 'image/jpeg'. [Check this page to see what format are supported.] (https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)
  • crossOrigin: Specify the crossOrigin of the image to resize

Compatibility

This module uses canvas, so it's only compatible with:

  • Firefox 4+
  • Chrome 14+
  • Internet explorer 9+
  • Safari 5+
  • ios ??
  • Android browser 4+
  • Chrome for android All

I need help

  • This angular component doesn't work on iPhones with iOS 8.1, but works on iPad and iPod touch with iOS 8.1. I still don't understand why, if someone has an explanation, it would be nice.
  • I don't know how to test the resizeLocalPic service. If someone can help me on this subject. Thanks

Special thanks

  • This module is widely inspired by this article of the [liip blog] (https://blog.liip.ch/archive/2013/05/28/resizing-images-with-javascript.html).

Licence

MIT