in reply to Re^2: Mojolicious: rendering images located outside of public directory
in thread Mojolicious: rendering images located outside of public directory

How do I insert this into <img src>? I still don't get it :).

src takes a path string, which part is render_static under? path path path path path path path path path path path path :)

see Re^2: Mojolicious, layouts and content generating. its tested, below isn't tested (template missing)

use Mojolicious::Lite; get '/render_static/:img' => sub { my $self = shift; my $img = $self->param('img'); my $path_to_private_images = ...( $img ); return $self->render_static( $path_to_private_images ); } __DATA__ .. <img src="<%= url_for( '/render_static/yo.png' ) -%>">
  • Comment on Re^3: Mojolicious: rendering images located outside of public directory
  • Download Code

Replies are listed 'Best First'.
Re^4: Mojolicious: rendering images located outside of public directory
by Kyshtynbai (Sexton) on Jun 19, 2014 at 07:44 UTC
    That's great! Thanks a lot!
Re^4: Mojolicious: rendering images located outside of public directory
by Kyshtynbai (Sexton) on Jun 19, 2014 at 08:36 UTC
    One more dumb question: Here in this code
    use Mojolicious::Lite; get '/render_static/:img' => sub { my $self = shift; my $img = $self->param('img'); my $path_to_private_images = ...( $img ); return $self->render_static( $path_to_private_images ); } __DATA__ .. <img src="<%= url_for( '/render_static/yo.png' ) -%>">
    The section Data. How do I address it from route defined above? It doesnt have name like gallery.html.ep or something...