heapsource/mongoose-attachments — pull request #35 by rngadam (2013-10-22 06:38:39+00:00)
Title: add an optional category to be inserted into the path

This lets us group attachments (for a particular customer or event).

Given this configuration:

```
ImageSchema.plugin(attachments, {
directory: "/home/rngadam/letsface/src/prototype/public/images",
storage : {
providerName: 'localfs',
options : {
removePrefix: "/home/rngadam/letsface/src/prototype/public"
}
},
properties: {
image: {
styles: {
original: {
// keep the original file
},
thumb: {
thumbnail: '100x100^',
gravity: 'center',
extent: '100x100',
'$format': 'jpg'
},
detail: {
resize: '400x400>',
'$format': 'jpg'
}
}
}
}
});
```

output of image property is:

```
image:
{ detail:
{ depth: 8,
format: 'JPEG',
oname: 'displayed.png',
mtime: Tue Oct 22 2013 14:27:03 GMT+0800 (CST),
ctime: Tue Oct 22 2013 14:27:03 GMT+0800 (CST),
size: 15957,
path: '/home/rngadam/letsface/src/prototype/public/images/zO0vt4yIo/detail/Sbz4kipeRM-detail.jpg',
defaultUrl: '/images/zO0vt4yIo/detail/Sbz4kipeRM-detail.jpg',
dims: [Object] },
thumb:
{ depth: 8,
format: 'JPEG',
oname: 'displayed.png',
mtime: Tue Oct 22 2013 14:27:03 GMT+0800 (CST),
ctime: Tue Oct 22 2013 14:27:03 GMT+0800 (CST),
size: 2952,
path: '/home/rngadam/letsface/src/prototype/public/images/zO0vt4yIo/thumb/Sbz4kipeRM-thumb.jpg',
defaultUrl: '/images/zO0vt4yIo/thumb/Sbz4kipeRM-thumb.jpg',
dims: [Object] },
original:
{ depth: 8,
format: 'PNG',
oname: 'displayed.png',
mtime: Tue Oct 22 2013 14:27:01 GMT+0800 (CST),
ctime: Tue Oct 22 2013 14:27:01 GMT+0800 (CST),
size: 77825,
path: '/home/rngadam/letsface/src/prototype/public/images/zO0vt4yIo/original/Sbz4kipeRM-original.png',
defaultUrl: '/images/zO0vt4yIo/original/Sbz4kipeRM-original.png',
dims: [Object] } },
```