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

s3img

v0.2.4

Published

s3img is an Amazon S3 Image Processing and Uploading Tool

Downloads

14

Readme

s3img - An Amazon S3 Image Processing and Uploading Tool

NPM

Purpose

s3img is a CLI tool based on Node.JS. Its original purpose is to convert and process images using ImageMagick and to upload those images to Amazon S3. The intention behind this is to provide different image resultions (thumbnails, preview, fullscale, etc.) for online shop systems.

Configuration

The configuration file includes various options.

{
	"s3": {
		"keyid"    : "your-key-id",
		"secret"   : "your-key-secret",
		"bucket"   : "bucket name",
		"region"   : "your region"
	},
	"cache"        : 315360000,
	"acl"          : "public-read",
	"extension"    : ".jpg",
	"threads"      : 1,
	"convertbin"   : "convert",
	"resizecmd"    : "%convertbin% %input% -trim -geometry %dimensions% -gravity center -background %bgcolor% -extent %dimensions% %output%",
	"sizes": {
		"thumb"    : [64, 50, "%convertbin% %input% -thumbnail %dimensions%^ -gravity center -extent %dimensions% %output%"],
		"preview"  : [165, 165],
		"full"     : [370, 370],
		"lightbox" : [1000, 1000]
	},
	"target"       : "./",
	"source"       : "./src",
	"magick": [
		"command1 %output%"
	]
}
  • The s3 object containse the access information for Amazon S3.
  • convertbin is the ImageMagick binary used for the convertion process
  • resizecmd specifies the default resize command. The following replacement options exist:
    • input: The input file path
    • output: The output file path
    • source: The source directory
    • target: The target directory
    • convertbin: The convert command
    • bgcolor: The background fill color. If not specified, the color of the first pixel will be used.
    • dimensions: The dimensions
  • sizes specifies an object consisting of the target with and height. An optional third parameter can be used to specify a custom resizecmd
  • source points to the source directory
  • target points to the target directory
  • magic is an array consisting of addtional commands that will be executed after the convertion operation. You can use the same variables as in resizecmd

Usage

s3img [OPTIONS]

CLI Options:

| Parameter | Type | Description | | --------- | ----------- | --------------------------------------------------------------------------------- | | | | | | help | boolean | Show help | | config | string | Configuration file (Type "s3img --config --help" for more) | | keyid | string | S3 key ID | | secret | string | S3 key secret | | bucket | string | S3 bucket ID | | region | string | S3 region (see http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) | | dir | string | The image directory | | source | string | The source directory for the original images | | upload | bool/string | Push images to S3 | | convert | bool/string | Convert images | | overwrite | bool | Overwrite existing images (default: skip) | | threads | number | Number of parallel AWS threads (default: 1) |

Convert images

Convert all images:

s3img -c ./config.json --convert

Convert a specific image set:

s3img -c ./config.json --convert=thumb

Upload images

Upload all images:

s3img -c ./config.json --upload

Upload a specific image set:

s3img -c ./config.json --upload=thumb

Requirements

Node.js with NPM (Tested with Node Version 0.10.22)

License

This work is licensed under the GNU Lesser General Public License (LGPL). You may also get a copy of the GNU Lesser General Public License from http://www.gnu.org/licenses/lgpl.txt.