zhimg
v1.3.0
Published
Image src util for zhihu images.
Downloads
14
Readme
zhimg
Image src util for zhihu images.
Install
$ npm install zhimgUsage
const zhimg = require('zhimg')
zhimg('https://pic1.zhimg.com/d38dd09765d51b5d163c555b081eea53_b.jpg').l
// => 'https://pic1.zhimg.com/d38dd09765d51b5d163c555b081eea53_l.jpg'
zhimg('d38dd09765d51b5d163c555b081eea53.jpg').m
// => 'https://pic.zhimg.com/d38dd09765d51b5d163c555b081eea53_m.jpg'
zhimg('d38dd09765d51b5d163c555b081eea53_b.jpg').size('200x112')
// => 'https://pic.zhimg.com/d38dd09765d51b5d163c555b081eea53_200x112.jpg'API
zhimg(src): return anImageinstance
Instance properties and methods:
img.src: return the parametersrcimg.host: return the host, with default value is'https://pic.zhimg.com/'img.version: the version,''or'v2'img.hash: a string with length 32img.ext: image extensionimg.b: often appears in answersimg.l: large size, 100x100img.m: medium size, 75x75img.r: raw imageimg.s: small size, 25x25img.t: 150x150img.xl: 200x200img.hd: high definition, the same as raw imageimg.size(size): custom size, e.g.200x112
