0.9.0-alpha.2 • Published 3 months ago

alchemy-media v0.9.0-alpha.2

Weekly downloads
4
License
MIT
Repository
github
Last release
3 months ago

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',

	// The location of cwebp
	cwebp: '/usr/bin/cwebp',

	// Enable webp
	webp: true,

	// Temporary map for intermediate file changes
	scratch: path.resolve(PATH_TEMP, 'scratch'),

	// 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

You will have to install certain packages on your system, you can do so like this on Debian/Ubuntu

Install the requirements of the veronica module:

apt-get install graphicsmagick webp libgif-dev libcairo2-dev libpango1.0-dev libjpeg-dev librsvg2-dev

This plugin requires exiv2

apt-get install exiv2 libexiv2-dev

This plugin requires libopencv packages

apt-get install libopencv-dev

This plugin requires magick++

apt-get install libmagick++-dev
0.9.0-alpha.2

3 months ago

0.9.0-alpha

3 months ago

0.7.6

8 months ago

0.7.5

10 months ago

0.8.0

7 months ago

0.7.4

1 year ago

0.7.3

1 year ago

0.7.2

1 year ago

0.7.1

1 year ago

0.6.3

2 years ago

0.6.2

2 years ago

0.6.4

2 years ago

0.7.0

2 years ago

0.6.1

2 years ago

0.5.2

3 years ago

0.6.0

3 years ago

0.5.1

3 years ago

0.5.0

4 years ago

0.4.2

5 years ago

0.4.1

6 years ago

0.4.0

7 years ago

0.2.0

8 years ago