Giter Site home page Giter Site logo

fakeimg's Introduction

Fake images generator

Build status Issue status NPM Version Downloads

When the client waits for the last moment to send the image files, and the layout is broken, you need a fake image to fill the gap.

Image providers

Example

const fakeimg = require('fakeimg')
    , fakeimg_pl = fakeimg.use('fakeimg.pl')
    , dummyimage = fakeimg.use('dummyimage')

const fakeimg_pl_object = fakeimg_pl({
  size: '400x200',
  background: '909090,255',
  foreground: 'fba,127',
  text: 'Fake image'
})

// https://fakeimg.pl/400x200/909090%2C255/fba%2C127/?text=Fake+image&font_name=yanone&font_size=50
console.log(fakeimg_pl_object.toString())

fakeimg_pl_object.download().then(http_response =>
  console.log('Fakeimg.pl download: Response status code ' + http_response.statusCode)
)

fakeimg_pl_object.downloadToFile('./fakeimg.pl.png').then(writestream =>
  console.log('Fakeimg.pl download: Writestream path', writestream.path)
)

const dummyimage_object = dummyimage({
  size: 300,
  text: 'Dummy image'
})

// https://dummyimage.com/300x300/cccccc/000000/?text=Dummy+image
console.log(dummyimage_object.toString())

dummyimage_object.download().then(http_response =>
  console.log('Dummyimage download: Response status code ' + http_response.statusCode)
)

dummyimage_object.downloadToFile('./dummyimage.png').then(writestream =>
  console.log('Dummyimage download: Writestream path', writestream.path)
)

License

MIT

fakeimg's People

Contributors

dptole avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.