Faker C++
Loading...
Searching...
No Matches
faker::image Namespace Reference

Enumerations

enum class  ImageCategory {
  Animals , Business , Cats , City ,
  Food , Nightlife , Fashion , People ,
  Nature , Sports , Technics , Transport
}
 

Functions

FAKER_CXX_EXPORT std::string imageUrl (unsigned width=640, unsigned height=480)
 Generates a random image url with `https://loremflickr.com/` or "https://picsum.photos".
 
FAKER_CXX_EXPORT std::string urlLoremFlickr (unsigned width=640, unsigned height=480, std::optional< ImageCategory > category=std::nullopt)
 Generates a real image url with `https://loremflickr.com/`.
 
FAKER_CXX_EXPORT std::string urlPicsumPhotos (unsigned width=640, unsigned height=480, std::optional< bool > greyscale=std::nullopt, std::optional< int > blur=std::nullopt)
 Generates a real image url with "https://picsum.photos" .
 
FAKER_CXX_EXPORT std::string githubAvatarUrl ()
 Generates a random avatar from GitHub.
 
FAKER_CXX_EXPORT std::string dimensions ()
 Generates a random image dimensions.
 
FAKER_CXX_EXPORT std::string_view type ()
 Generates a random type of image.
 

Enumeration Type Documentation

◆ ImageCategory

enum class faker::image::ImageCategory
strong
Enumerator
Animals 
Business 
Cats 
City 
Food 
Nightlife 
Fashion 
People 
Nature 
Sports 
Technics 
Transport 

Function Documentation

◆ dimensions()

FAKER_CXX_EXPORT std::string faker::image::dimensions ( )

Generates a random image dimensions.

Returns
Random image dimensions.
faker::image::dimensions() // "1920x1080"
FAKER_CXX_EXPORT std::string dimensions()
Generates a random image dimensions.

◆ githubAvatarUrl()

FAKER_CXX_EXPORT std::string faker::image::githubAvatarUrl ( )

Generates a random avatar from GitHub.

Returns
Url to github avatar.
faker::image::githubAvatarUrl() // "https://avatars.githubusercontent.com/u/9716558"
FAKER_CXX_EXPORT std::string githubAvatarUrl()
Generates a random avatar from GitHub.

◆ imageUrl()

FAKER_CXX_EXPORT std::string faker::image::imageUrl ( unsigned width = 640,
unsigned height = 480 )

Generates a random image url with `https://loremflickr.com/` or "https://picsum.photos".

Parameters
widthThe width of the image. Defaults to `640`.
heightThe height of the image. Defaults to `480`.
Returns
Random real image url from external service.
faker::image::imageUrl() // "https://loremflickr.com/640/480" or "https://picsum.photos/640/480"
FAKER_CXX_EXPORT std::string imageUrl(unsigned width=640, unsigned height=480)
Generates a random image url with `https://loremflickr.com/` or "https://picsum.photos".

◆ type()

FAKER_CXX_EXPORT std::string_view faker::image::type ( )

Generates a random type of image.

Returns
Type of image.
FAKER_CXX_EXPORT std::string_view type()
Generates a random type of image.

◆ urlLoremFlickr()

FAKER_CXX_EXPORT std::string faker::image::urlLoremFlickr ( unsigned width = 640,
unsigned height = 480,
std::optional< ImageCategory > category = std::nullopt )

Generates a real image url with `https://loremflickr.com/`.

Parameters
widthThe width of the image. Defaults to `640`.
heightThe height of the image. Defaults to `480`.
categoryThe optional category of generated real image.
Returns
Random real image url from external service.
faker::image::urlLoremFlickr() // "https://loremflickr.com/640/480"
faker::image::urlLoremFlickr(800, 600) // "https://loremflickr.com/800/600"
faker::image::urlLoremFlickr(800, 600, ImageCategory::Animals) // "https://loremflickr.com/800/600/animals"
FAKER_CXX_EXPORT std::string urlLoremFlickr(unsigned width=640, unsigned height=480, std::optional< ImageCategory > category=std::nullopt)
Generates a real image url with `https://loremflickr.com/`.
ImageCategory
Definition image.h:12
Definition airline.h:9

◆ urlPicsumPhotos()

FAKER_CXX_EXPORT std::string faker::image::urlPicsumPhotos ( unsigned width = 640,
unsigned height = 480,
std::optional< bool > greyscale = std::nullopt,
std::optional< int > blur = std::nullopt )

Generates a real image url with "https://picsum.photos" .

Parameters
widthThe width of the image. Defaults to `640`.
heightThe height of the image. Defaults to `480`.
greyscaleThe optional greyscale filter. True for apply or false for disabled
blurThe optional blur effect between 1 and 10
Returns
Random real image url from external service
faker::image::urlPicsPhotos() // "https://picsum.photos/640/480"
faker::image::urlPicsPhotos(800,600,true) // "https://picsum.photos/800/600?grayscale
faker::image::urlPicsPhotos(800,600,false,5) // "https://picsum.photos/800/600?blur=5
faker::image::urlPicsPhotos(800,600,true,1) // "https://picsum.photos/800/600?grayscale&blur=1