I'm trying to return a file from controller to view (more specific a .jpeg) and not the path because I don't want to be seen.
This is my code at the moment:
sub get_avatar {
my $self = shift;
my $username = $self->stash('id');
my $home = Mojo::Home->new;
$home->detect('SuperSecret');
my $path = $home->child('my', 'path', "$username");
my $file;
if (-e $path) {
$file = "my/path/$username";
} else {
$file = "my/path/default.png";
}
return $file;
}
