Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9530d27
feat(image): Add AI-generated avatars
matthewmayer Sep 21, 2024
2bb43b9
fix tests
matthewmayer Sep 21, 2024
28e5cf7
Merge branch 'next' into avatar-ai
ST-DDT Oct 26, 2024
5312d51
Merge branch 'next' into avatar-ai
matthewmayer Feb 3, 2025
c359235
update to personPortrait and new URIs
matthewmayer Feb 3, 2025
d6be62b
Merge branch 'next' into avatar-ai
matthewmayer Feb 3, 2025
895d653
bump since value
matthewmayer Feb 4, 2025
acfd587
add this to the weekly url availability checks:
matthewmayer Feb 4, 2025
3438d59
new test
matthewmayer Feb 4, 2025
6b2b0b8
remove 16px size
matthewmayer Feb 4, 2025
6407fca
Merge branch 'next' into avatar-ai
matthewmayer Feb 4, 2025
b726bb8
update docs
matthewmayer Feb 4, 2025
e987dbc
Update index.ts
matthewmayer Feb 5, 2025
e963e43
Update index.ts
matthewmayer Feb 5, 2025
6638f8d
Update index.ts
matthewmayer Feb 5, 2025
93b964c
Update index.ts
matthewmayer Feb 5, 2025
1c32022
Update index.ts
matthewmayer Feb 5, 2025
f7882cb
Update index.ts
matthewmayer Feb 5, 2025
f8c699e
Update index.ts
matthewmayer Feb 5, 2025
7ab7522
Update index.ts
matthewmayer Feb 5, 2025
425c2cf
Update index.ts
matthewmayer Feb 5, 2025
5e8dabb
fix URL
matthewmayer Feb 5, 2025
949ccec
tweak docs
matthewmayer Feb 5, 2025
557b25e
Update index.ts
matthewmayer Feb 5, 2025
e23fd66
final urls
matthewmayer Feb 7, 2025
8ed7ef7
new tests
matthewmayer Feb 7, 2025
5c248a3
final urls
matthewmayer Feb 7, 2025
a35394b
chore: fix import scan
ST-DDT Feb 7, 2025
242609e
chore: format
ST-DDT Feb 7, 2025
41b893c
Merge branch 'next' into avatar-ai
ST-DDT Feb 7, 2025
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix URL
  • Loading branch information
matthewmayer committed Feb 5, 2025
commit 5e8dabba0914595040df923484596c3c9e6281dd
36 changes: 19 additions & 17 deletions src/modules/image/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,29 @@ export class ImageModule extends ModuleBase {
*
* @since 9.5.0
*/
personPortrait(options: {
/**
* The sex of the person for the avatar.
* Can be `'female'` or `'male'`.
*
* @default faker.person.sexType()
*/
sex?: SexType;
/**
* The size of the image.
* Can be `512`, `256`, `128`, `64` or `32`.
*
* @default 512
*/
size?: 512 | 256 | 128 | 64 | 32;
} = {}): string {
personPortrait(
options: {
/**
* The sex of the person for the avatar.
* Can be `'female'` or `'male'`.
*
* @default faker.person.sexType()
*/
sex?: SexType;
Comment thread
matthewmayer marked this conversation as resolved.
/**
* The size of the image.
* Can be `512`, `256`, `128`, `64` or `32`.
*
* @default 512
*/
size?: 512 | 256 | 128 | 64 | 32;
} = {}
): string {
const { sex = this.faker.person.sexType(), size = 512 } = options;
// FIXME: This should be replaced by the final CDN url, presumably something like: 'https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait'
const baseURL =
'https://cdn.jsdelivr.net/gh/matthewmayer/assets-person-portrait@new-images';
return `${baseURL}/${type}/${size}/${this.faker.number.int({ min: 0, max: 99 })}.jpg`;
return `${baseURL}/${sex}/${size}/${this.faker.number.int({ min: 0, max: 99 })}.jpg`;
}

/**
Expand Down