<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
> Can I use send_file together with a template ? Let's say I want to render<br>
> html with an image,<br>
<br>
</span>Serving HTML and image for this HTML-page are 2 separate requests, you<br>
can't send them together.<br>
<br>
Using send_file seems not appropriate, because it sets<br>
Content-disposition-header. Which means: browser downloads a file, but<br>
you want to show it inside HTML.<br>
<br></blockquote><div><br></div><div>I see, that's what I was suspecting.<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> Any other ideas ?<br>
<br>
For example, you may link this images directory symbolically into<br>
session-named directory and use this name as prefix in your template.<br></blockquote><div><br></div><div>This sounds as the solution for me, though it is not that flexible as the before hook.<br>Alternatively I can switch to Dancer 1:)<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Another way (my preference) is to use some Plack middleware for<br>
authorization and use it as gatekeeper which makes sure, that some<br>
directories (or just files) are accessible only to certain (logged in)<br>
users.<br></blockquote><div><br></div><div>I use Dancer2::Plugin::Auth::Extensible and switching to another <br>authentication will make the whole thing more complicated, so for now I'll try to play with symlinks.<br><br></div><div>Thank you for your help.<br></div></div><br></div></div>