lib/gngb-api.js
function (res, name, version) {
  //Options
  var imgPath, width;
  //RegExp
  var re = /^\d\.\d.\d$/;
  //Test version
  if (re.test(version)) {
    imgPath = path.join(dir, name + '.png');
    width = 76;
  } else if (version.length === 6) {
    imgPath = path.join(dir, name + '-larger.png');
    width = 80;
  } else if (version.length === 7) {
    imgPath = path.join(dir, name + '-larger.png');
    width = 77;
  } else {
    imgPath = path.join(dir, name + '-larger.png');
    width = 74;
  }

  //Create Image
  var base = gm(imgPath)
    .font(path.join(__dirname, 'fonts', 'Arial.ttf'))
    .fontSize(10)
    .fill('#ffffff')
    .drawText(width, 12, version);
  //Write Stream and send to client
  write(base, res);
}
function (res, name, version) {
  //Options
  var imgPath, width;
  //RegExp
  var re = /^\d\.\d.\d$/;
  //Test version
  if (re.test(version)) {
    imgPath = path.join(dir, name + '.png');
    width = 76;
  } else if (version.length === 6) {
    imgPath = path.join(dir, name + '-larger.png');
    width = 80;
  } else if (version.length === 7) {
    imgPath = path.join(dir, name + '-larger.png');
    width = 77;
  } else {
    imgPath = path.join(dir, name + '-larger.png');
    width = 74;
  }

  //Create Image
  var base = gm(imgPath)
    .font(path.join(__dirname, 'fonts', 'Arial.ttf'))
    .fontSize(10)
    .fill('#ffffff')
    .drawText(width, 12, version);
  //Write Stream and send to client
  write(base, res);
}
function ( res , name , version ) { //Options var imgPath , width ; //RegExp var re = / ^\d\.\d.\d$ / ; //Test version if ( re . test ( version ) ) { imgPath = path . join ( dir , name + '.png' ) ; width = 76 ; } else if ( version . length === 6 ) { imgPath = path . join ( dir , name + '-larger.png' ) ; width = 80 ; } else if ( version . length === 7 ) { imgPath = path . join ( dir , name + '-larger.png' ) ; width = 77 ; } else { imgPath = path . join ( dir , name + '-larger.png' ) ; width = 74 ; } //Create Image var base = gm ( imgPath ) . font ( path . join ( __dirname , 'fonts' , 'Arial.ttf' ) ) . fontSize ( 10 ) . fill ( '#ffffff' ) . drawText ( width , 12 , version ) ; //Write Stream and send to client write ( base , res ) ; }
Create version badge
Create version badge