Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

imagecachejs

Package Overview
Dependencies
Maintainers
3
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imagecachejs - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

docs/kitten-blur-15.png

28

dist/index.js

@@ -51,2 +51,6 @@ 'use strict';

var _url = require('url');
var _url2 = _interopRequireDefault(_url);
var _tinycolor = require('tinycolor2');

@@ -114,3 +118,3 @@

var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(urlpath, query) {
var hash, ext, cachedPath, url;
var hash, filepath, format, ext, cachedPath, url;
return _regenerator2.default.wrap(function _callee2$(_context2) {

@@ -121,7 +125,9 @@ while (1) {

hash = (0, _jsonHash.digest)({ urlpath: urlpath, query: query });
ext = getFormat(query.fm);
filepath = urlpath.split('/').pop().split('.').pop();
format = query.fm || filepath;
ext = getFormat(format);
cachedPath = _path3.default.resolve(options.destination, hash + '.' + ext);
if (!_fs2.default.existsSync(cachedPath)) {
_context2.next = 5;
_context2.next = 7;
break;

@@ -132,15 +138,15 @@ }

case 5:
_context2.next = 7;
case 7:
_context2.next = 9;
return getUrl(urlpath);
case 7:
case 9:
url = _context2.sent;
_context2.next = 10;
_context2.next = 12;
return process(url, cachedPath, query);
case 10:
case 12:
return _context2.abrupt('return', cachedPath);
case 11:
case 13:
case 'end':

@@ -411,4 +417,2 @@ return _context2.stop();

console.log(value);
var matches = value.match(/(\d*),(\w*)/);

@@ -430,4 +434,2 @@

console.log(border, hex);
var verticalBorder = new _jimp2.default(border, image.bitmap.height, hex);

@@ -434,0 +436,0 @@

{
"name": "imagecachejs",
"version": "0.0.9",
"version": "0.0.10",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -41,6 +41,6 @@ # imagecache.js

<tr>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-bri-50.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.png" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-bri-50.png" width="300" /></td>
</tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.jpg?bri=50</td></tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.png?bri=50</td></tr>
</table>

@@ -50,6 +50,6 @@

<tr>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-bri--50.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.png" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-bri--50.png" width="300" /></td>
</tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.jpg?bri=-50</td></tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.png?bri=-50</td></tr>
</table>

@@ -62,6 +62,6 @@

<tr>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-con-50.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.png" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-con-50.png" width="300" /></td>
</tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.jpg?con=50</td></tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.png?con=50</td></tr>
</table>

@@ -71,6 +71,6 @@

<tr>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-con--50.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.png" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-con--50.png" width="300" /></td>
</tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.jpg?con=-50</td></tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.png?con=-50</td></tr>
</table>

@@ -83,6 +83,6 @@

<tr>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-flip-h.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.png" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-flip-h.png" width="300" /></td>
</tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.jpg?flip=h</td></tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.png?flip=h</td></tr>
</table>

@@ -92,6 +92,6 @@

<tr>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-flip-v.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.png" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-flip-v.png" width="300" /></td>
</tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.jpg?flip=v</td></tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.png?flip=v</td></tr>
</table>

@@ -101,6 +101,6 @@

<tr>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-flip-vh.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.png" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-flip-vh.png" width="300" /></td>
</tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.jpg?flip=vh</td></tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.png?flip=vh</td></tr>
</table>

@@ -113,6 +113,6 @@

<tr>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-col-greyscale.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.png" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-col-greyscale.png" width="300" /></td>
</tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.jpg?col=greyscale</td></tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.png?col=greyscale</td></tr>
</table>

@@ -122,6 +122,6 @@

<tr>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-col-sepia.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.png" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-col-sepia.png" width="300" /></td>
</tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.jpg?col=sepia</td></tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.png?col=sepia</td></tr>
</table>

@@ -134,6 +134,6 @@

<tr>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-blur-15.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.png" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-blur-15.png" width="300" /></td>
</tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.jpg?blur=15</td></tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.png?blur=15</td></tr>
</table>

@@ -146,8 +146,101 @@

<tr>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-rot-45.jpg" height="200" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.png" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-rot-45.png" height="200" /></td>
</tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.jpg?rot=45</td></tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.png?rot=45</td></tr>
</table>
## Padding
Put x pixels of padding around the image
<table>
<tr>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.png" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-pad-50.png" height="200" /></td>
</tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.png?pad=50</td></tr>
</table>
## Border
Draw an x pixel thick border around the image
<table>
<tr>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.png" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-border-50-red.png" height="200" /></td>
</tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.png?border=50,red</td></tr>
</table>
## Hue
Rotate the hue of an image with a value between -360 and 360 degrees
<table>
<tr>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.png" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-hue-90.png" height="200" /></td>
</tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.png?hue=90</td></tr>
</table>
<table>
<tr>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.png" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-hue--90.png" height="200" /></td>
</tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.png?hue=-90</td></tr>
</table>
## Saturation
Increase or decrease the saturation of an image with an amount between -100% and 100%
<table>
<tr>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.png" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-sat-50.png" height="200" /></td>
</tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.png?sat=50</td></tr>
</table>
<table>
<tr>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.png" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-sat--50.png" height="200" /></td>
</tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.png?sat=-50</td></tr>
</table>
## Tint
Tint the image with a layer of white with a opacity value between 1 and 100
<table>
<tr>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.png" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-tint-50.png" height="200" /></td>
</tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.png?tint=50</td></tr>
</table>
## Shade
Shade the image with a layer of black with a opacity value between 1 and 100
<table>
<tr>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.png" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-shade-50.png" height="200" /></td>
</tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.png?shade=50</td></tr>
</table>
## Invert
Invert the colors of the image
<table>
<tr>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.png" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-invert.png" height="200" /></td>
</tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.png?invert=true</td></tr>
</table>
## Crop

@@ -158,6 +251,6 @@ Crop the image using a reactangle in the format "x,y,w,h"

<tr>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.jpg" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-crop-100-100-400-200.jpg" width="200" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten.png" width="300" /></td>
<td><img src="https://raw.githubusercontent.com/mahaplatform/imagecachejs/master/docs/kitten-crop-100-100-400-200.png" width="200" /></td>
</tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.jpg?crop=100,100,400,200</td></tr>
<tr><td colspan="2">http://localhost:3000/imagecache/images/kitten.png?crop=100,100,400,200</td></tr>
</table>

@@ -168,8 +261,8 @@

http://localhost:3000/imagecache/images/kitten.jpg?w=500
http://localhost:3000/imagecache/images/kitten.png?w=500
http://localhost:3000/imagecache/images/kitten.jpg?w=200&dpi=2
http://localhost:3000/imagecache/images/kitten.png?w=200&dpi=2
http://localhost:3000/imagecache/images/kitten.jpg?h=250
http://localhost:3000/imagecache/images/kitten.png?h=250
http://localhost:3000/imagecache/images/kitten.jpg?w=300&h=300
http://localhost:3000/imagecache/images/kitten.png?w=300&h=300

@@ -9,2 +9,3 @@

import Jimp from 'jimp'
import URL from 'url'
import tinycolor from 'tinycolor2'

@@ -45,4 +46,8 @@ import { digest } from 'json-hash'

const ext = getFormat(query.fm)
const filepath = urlpath.split('/').pop().split('.').pop()
const format = query.fm || filepath
const ext = getFormat(format)
const cachedPath = path.resolve(options.destination, `${hash}.${ext}`)

@@ -49,0 +54,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc