Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: Mojolicious: rendering images located outside of public directory

by Anonymous Monk
on Jun 19, 2014 at 07:35 UTC ( #1090408=note: print w/ replies, xml ) Need Help??


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
Re^4: Mojolicious: rendering images located outside of public directory
by Kyshtynbai (Acolyte) 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 (Acolyte) 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...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1090408]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (14)
As of 2014-07-24 14:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (160 votes), past polls