fakeimg

2.2.1 • Public • Published

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

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i fakeimg

    Weekly Downloads

    17

    Version

    2.2.1

    License

    MIT

    Unpacked Size

    13 kB

    Total Files

    11

    Last publish

    Collaborators

    • dptole