Current section

Files

Jump to
blah src blah@image.erl
Raw

src/blah@image.erl

-module(blah@image).
-compile([no_auto_import, nowarn_unused_vars]).
-export([with_category/3, avatar/2, animal/2, cat/2, dog/2, food/2, sports/2, people/2, fashion/2, whatever/2]).
-spec with_category(integer(), integer(), binary()) -> binary().
with_category(Width, Height, Category) ->
<<<<<<<<<<<<<<"https://loremflickr.com/"/utf8,
(gleam@int:to_string(Width))/binary>>/binary,
"/"/utf8>>/binary,
(gleam@int:to_string(Height))/binary>>/binary,
"/"/utf8>>/binary,
Category/binary>>/binary,
"?lock="/utf8>>/binary,
(gleam@int:to_string(gleam@int:random(4, 4294967296)))/binary>>.
-spec avatar(integer(), integer()) -> binary().
avatar(Width, Height) ->
Category = blah@utils:get_random_item(
[<<"portrait"/utf8>>,
<<"celebrity"/utf8>>,
<<"face"/utf8>>,
<<"smile"/utf8>>]
),
with_category(Width, Height, Category).
-spec animal(integer(), integer()) -> binary().
animal(Width, Height) ->
with_category(Width, Height, <<"animal"/utf8>>).
-spec cat(integer(), integer()) -> binary().
cat(Width, Height) ->
with_category(Width, Height, <<"cat"/utf8>>).
-spec dog(integer(), integer()) -> binary().
dog(Width, Height) ->
with_category(Width, Height, <<"dog"/utf8>>).
-spec food(integer(), integer()) -> binary().
food(Width, Height) ->
with_category(Width, Height, <<"food"/utf8>>).
-spec sports(integer(), integer()) -> binary().
sports(Width, Height) ->
with_category(Width, Height, <<"sports"/utf8>>).
-spec people(integer(), integer()) -> binary().
people(Width, Height) ->
with_category(Width, Height, <<"people"/utf8>>).
-spec fashion(integer(), integer()) -> binary().
fashion(Width, Height) ->
with_category(Width, Height, <<"fasion"/utf8>>).
-spec whatever(integer(), integer()) -> binary().
whatever(Width, Height) ->
<<<<<<<<<<"https://picsum.photos/seed/"/utf8,
(gleam@int:to_string(gleam@int:random(4, 4294967296)))/binary>>/binary,
"/"/utf8>>/binary,
(gleam@int:to_string(Width))/binary>>/binary,
"/"/utf8>>/binary,
(gleam@int:to_string(Height))/binary>>.