New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

oversized-images

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oversized-images

checks image sizes and creates a preview version

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

Oversized

##creates a preview from oversized images

When you are working with professional camera equipment it is common that you encounter oversized picture resolutions that will cause rendering problems in a web context.

To prevent this, the Oversized package allows the dynamic creation of preview images. In order to make use of it, you have to browserify your project.

	npm install oversized-images

To require it, call:

	var oversized = require("oversized-images");

Then you create an oversized object:

	
	var reducer = new oversized({
	  		max: 1.4,
  			max_width: 1920,
  			max_height: 1080,
  			suffix: '_prvw'
  			});
  • max: affects all the pictures that have a size greater than max [in MB]
  • max-width: the maximal width of your preview
  • max-height: the maximal height of your preview
  • suffix: allows you to define the preview suffix
  • callback: callback function, receives the array of files that suffices the preview condition

To invoke the reduction process, call

	reducer.check([files]);

The parameter files takes a directory, as single files or an array of files. If you choose a directory, the library uses a recursive directory search. Therefore, you can scan and manipulate all the embedded subfolders. Since the library uses Q promises, all the calls are chained. By using a callback you can use it asynchronously.

So your call might look like this:

  
    function done(result) {
      console.log("processed " + result);
  };

	var test = new Oversized({
	  max: 1.4,
	  max_width: 1920,
	  max_height: 1080,
	  callback: done,
	  });

	var a = test.check(["file1.jpg", "file2.jpg", "file3.jpg"]);

The callback gets an array of files that matches the preview conditions.

Keywords

resize

FAQs

Package last updated on 29 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts