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

dynasyze

v0.2.0

Published

Dynamic image resizing and cropping server

Downloads

31

Readme

dynasyze

A standalone media server that dynamically resizes and crops image files

Installing

Requires Node 5.0.0+

npm install -g dynasyze

GraphicsMagick or ImageMagick

Usage

dynasyze --config /path/to/config.json

Request Format

http://localhost:3000/[subdirectory]/:size/:key

You can exclude the :size field and only supply [subdirectory]/:key to fetch the original image

Within :size, specifying only the width (e.g. 300) or only the height (e.g. x300) will scale the image to the given dimension

Example requests

http://localhost:3000/300x300/test.jpeg

http://cdn.example.com/user/avatars/x150/avatar.png

http://cdn.c2334.co/images/3000/banner.png

Help

dynasyze --help

config.json

Options

port - Local port on which to run the media server

whitelist - If not empty, only size strings that appear within this array will be accepted.

aliases - Map of custom directory names and their corresponding size string. (e.g. { "small": "300x300" })

subdirectory - Subdirectory to preceed the size and key fields (e.g. http://localhost:3000/images/x300/)

store - Storage settings

store.max_width - Maximum width able to be requested (null for no max)

store.max_height - Maximum height able to be requested (null for no max)

store.root - The root directory for media storage

store.raw - The directory containing the original media files ("" or null for same as root)

store.keep - true to keep resized media, false to discard

store.inflate - If true and the requested size is larger than the requested image, inflated the image to fill the container

store.aws - Parameters for using AWS S3 for media storage. If null, uses local filesystem

store.aws.accessKeyID - AWS access key ID

store.aws.secretAccessKey - AWS secret access key

store.aws.region - Region of S3 Bucket

store.aws.bucket - Bucket for media storage

cache - Cache settings, used to track processing images and allow subsequent calls to wait on the processing file

cache.expire_after - Seconds to wait before timing out on a processing image

cache.redis - Parameters for creating a redis client (see package redis). If null, uses Map object

Default

{
    "port": 3000,
    "whitelist": [ ],
    "aliases": { },
    "subdirectory": "",
    "store": {
        "max_width": null,
        "max_height": null,
        "root": "",
        "raw": "raw",
        "keep": true,
        "inflate": false,
        "imageMagick": false,
        "aws": null
    },
    "cache": {
        "expire_after": 15,
        "redis": null
    }
}

Notes

When requesting a size that is not proportional to the original image, the content is centered and cropped. Currently, this gravity of the cropping is not optional.

License

MIT