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 🙏

© 2026 – Pkg Stats / Ryan Hefner

alchemy-media

v0.9.0

Published

The media plugin for Alchemy

Downloads

165

Readme

Alchemy Media

The media plugin for the Alchemy MVC

Installation

Just installing the npm package can be done like this:

$ npm install alchemy-media

Activate

You can activate the plugin by adding this to the main bootstrap.js file:

alchemy.usePlugin('media', {});

The second parameter is an object containing options. These are currently the default settings:

var options = {

	// The path to use in the url
	url: '/media/image',

	// Where to store the files
	path: path.resolve(PATH_ROOT, 'files'),

	// Which hash function to use
	hash: 'sha1',

	// The location of the exiv2 binary
	exiv2: '/usr/bin/exiv2',

	// Enable webp
	webp: true,

	// The cache map for resized images & thumbnails
	cache: path.resolve(PATH_TEMP, 'imagecache')
};

PATH_ROOT points to the main project folder. PATH_TEMP does not point to /tmp, but to the temp folder in the PATH_ROOT (main project) folder.

Use

This plugin provides you with a Hawkejs helper to resize images on-the-fly (on request, actually). This is how you create an image element using an image record id:

<%= Media.image(image_id, {width: '50%'}) %>

Or using a static image asset:

<%= Media.image('file_in_image_folder.jpg', {width: '25%', className: 'myclass'}) %>

The supplied width percentage isn't relative to the image itself, but to the user's screen resolution.

System dependencies

This plugin uses sharp for image processing, which comes with pre-built binaries for all major platforms (no system packages needed).

For placeholder image generation, you'll need the canvas dependencies:

# Debian/Ubuntu
sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev

# macOS
brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman

# Arch Linux
sudo pacman -S cairo pango giflib libjpeg-turbo librsvg

This plugin uses exiv2 for reading image metadata:

apt-get install exiv2 libexiv2-dev