Skip to content

Commit

Permalink
Add width and height options for filename template
Browse files Browse the repository at this point in the history
Fixes #138.
  • Loading branch information
paazmaya authored and kevva committed Oct 31, 2014
1 parent 50ebb18 commit c62b3f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ exports.save = function (streams, cb) {
exports.create = function (uri, size, options) {
var isFile = fs.existsSync(uri);
var newUrl;
var sizes = size.split('x');

if (isFile) {
newUrl = fileUrl(uri);
Expand All @@ -141,6 +142,8 @@ exports.create = function (uri, size, options) {
crop: options.crop ? '-cropped' : '',
date: date('Y-M-d'),
size: size,
width: sizes[0],
height: sizes[1],
url: slugify(isFile ? uri : newUrl).replace(/^(?:https?:\/\/)?www\./, '')
});

Expand Down
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ Available variables:

- `url`: The URL in [slugified](https:/ogt/slugify-url) form, eg. `http://yeoman.io/blog/` becomes `yeoman.io!blog`
- `size`: Specified size, eg. `1024x1000`
- `width`: Width of the specified size, eg. `1024`
- `height`: Height of the specified size, eg. `1000`
- `crop`: Outputs `-cropped` when the crop option is true
- `date`: The current date

Expand Down

0 comments on commit c62b3f2

Please sign in to comment.