|
|
/**
|
|
|
* Handlebars helpers
|
|
|
* bikai kai.bi@yoho.cn
|
|
|
* 2016-05-10
|
|
|
*/
|
|
|
|
|
|
var _ = require('lodash');
|
|
|
|
|
|
/**
|
|
|
* 七牛图片路径处理
|
|
|
* @param {[tring]} url
|
|
|
* @param {[tring]} width
|
|
|
* @param {[tring]} height
|
|
|
* @param {[tring]} mode
|
|
|
* @return {[tring]}
|
|
|
*/
|
|
|
exports.image = function(url, width, height, mode) {
|
|
|
mode = _.isNumber(mode) ? mode : 1;
|
|
|
return url.replace(/{width}/g, width).replace(/{height}/g, height).replace(/{mode}/g, mode);
|
|
|
}; |
...
|
...
|
|