-
Notifications
You must be signed in to change notification settings - Fork 3
/
image.gleam
55 lines (43 loc) · 1.38 KB
/
image.gleam
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import gleam/int
import blah/utils.{get_random_item}
pub fn avatar(width: Int, height: Int) {
let category = get_random_item(["portrait", "celebrity", "face", "smile"])
with_category(category, width, height)
}
pub fn animal(width: Int, height: Int) {
with_category("animal", width, height)
}
pub fn sloth(width: Int, height: Int) {
with_category("sloth", width, height)
}
pub fn jellyfish(width: Int, height: Int) {
with_category("jellyfish", width, height)
}
pub fn cat(width: Int, height: Int) {
with_category("cat", width, height)
}
pub fn dog(width: Int, height: Int) {
with_category("dog", width, height)
}
pub fn food(width: Int, height: Int) {
with_category("food", width, height)
}
pub fn sports(width: Int, height: Int) {
with_category("sports", width, height)
}
pub fn people(width: Int, height: Int) {
with_category("people", width, height)
}
pub fn fashion(width: Int, height: Int) {
with_category("fashion", width, height)
}
pub fn with_category(category: String, width: Int, height: Int) {
"https://loremflickr.com/" <> int.to_string(width) <> "/" <> int.to_string(
height,
) <> "/" <> category <> "?lock=" <> int.to_string(int.random(4, 4_294_967_296))
}
pub fn whatever(width: Int, height: Int) {
"https://picsum.photos/seed/" <> int.to_string(int.random(4, 4_294_967_296)) <> "/" <> int.to_string(
width,
) <> "/" <> int.to_string(height)
}