Skip to content

Commit

Permalink
Document image generators (#58)
Browse files Browse the repository at this point in the history
* Removing -v option in PR template

* Add examples of how to use Image genrators to create random images in
README
  • Loading branch information
jaswdr authored May 3, 2021
1 parent 198b153 commit f16f994
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ for i:=0; i < 10; i++ {
// Ms. Karley Kiehn V
```

You can also generate a profile image.

```go
image := p.Image()

fmt.Println(image.Name())
// /tmp/profil-picture-img-1064677774.jfif

fmt.Printf("%+v", image)
// &{file:0xc0002e4300}
```

Generate fake data using Structs

```go
Expand All @@ -91,6 +103,25 @@ fmt.Printf("%+v", example)
//{SimpleStringField:87576a01c2a547b2bbf9b7c736d1db40 SimpleNumber:9223372036854775807 SimpleBool:false SomeFormatedString:cxo 321 SomeStringArray:[effr swxp ldnj obcs nvlg]}
```

Generate random placeholder images using [LoremFlickr](https://loremflickr.com/)

```go
// get a *os.File pointing to a file that is a random image
image := f.LoremFlickr().Image(100, 100, []string{}, "", false)

fmt.Println(image.Name())
// /tmp/loremflickr-img-4101493944.jpg
```

Generate profile images using [ThisPersonDoesNotExist](https://thispersondoesnotexist.com/)

```go
profileImage := f.ProfileImage().Image()

fmt.Println(profileImage.Name())
// /tmp/profil-picture-img-4022222298.jfif
```

See more formatters in [docs](https://pkg.go.dev/github.com/jaswdr/faker?tab=doc)

## Get involved
Expand Down
2 changes: 1 addition & 1 deletion pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ $ go version
**Go Tests**

```
$ go test -v
$ go test
# replace this line with the output
```

0 comments on commit f16f994

Please sign in to comment.