First, you can put inside of the img tag the URL that Mojo will handle by delivering the static binary image content directly ( don't forget to set content type ). For example, http://path/to/mojo/getImage/<imageID>
Second, you can have your image in a public directory available directly to any web browser. You would then just populate the img's src attribute with this URL using a template or directly generating the content. For example, http://path/too/image.jpg
It seems to me that you're interested in doing the former - having Mojo deliver the binary content of an image (or some file) that is residing in a private directory. This approach requires that Mojo have at least 2 route handers - one to deliver the HTML and one to deliver the image's binary content.
I suppose if you want to get fancy, you could embed the binary content directly in the HTML, but I wouldn't recommend it since it's a very inflexible approach that is typically used only for optimizing certain situations.
In reply to Re^3: Mojolicious: rendering images located outside of public directory
by perlfan
in thread Mojolicious: rendering images located outside of public directory
by Kyshtynbai
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |