3.0.10 • Published 2 years ago

picsum-photos v3.0.10

Weekly downloads
183
License
ISC
Repository
gitlab
Last release
2 years ago

Lorem Picsum (picsum.phtos) TypeScript client

Testing Status Badge

Also supports random images in original resuliton

NPM package: https://www.npmjs.com/package/picsum-photos

Git repo: https://gitlab.com/ap3k/node_modules/picsum-photos

Lorem-picsum: https://picsum.photos/

Installation

With NPM

npm install picsum-photos

With Yarn

yarn add picsum-photos

Usage

Read the Source luke!

Get random image in original size

// Require it in
const { Picsum } = require('picsum-photos')

const image = await Picsum.random()
// image
interface ImageObject {
  id: number;            // Image ID in Lorem Picsum
  author: string;        // Image author
  width: number;         // Image width
  height: number;        // Image height
  url: string;           // Image original URL (source site)
  download_url: string;  // Image direct URL for download
}

Get image with certain properties

// Require it in
const { Picsum } = require('picsum-photos')


// Possible config values
interface PicsumConfig {
  blur?: number;         // Level of image blurriness form 0-10 (0)
  cache?: boolean;       // Allow browser image cache, (true)
  grayscale?: boolean;   // Image grayscale or normal, (false)
  height?: number;       // Image height (200)
  id?: number;           // Get certain image with given ID (0)
  jpg?: boolean;         // Get image url as .jpg (false)
  width?: number;        // Image width (200)
}


Picsum.url()
// https://picsum.photos/200/200

// Overwrite defaults
Picsum.url({
  blur: 2
  cache: false
  grayscale: true
  height: 200
  id: 30
  jpg: true
  width: 300
})
// https://picsum.photos/id/30/200/300.jpg?grayscale=true&blur=2
3.0.10

2 years ago

3.0.8

2 years ago

3.0.9

2 years ago

3.0.7

3 years ago

3.0.6

3 years ago

3.0.5

3 years ago

3.0.4

3 years ago

3.0.3

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.1.3

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago