Sorry, your issue is in routing: your showimg route is POST-only, but browsers will always use GET to request an image.
On Thu, Apr 5, 2018 at 2:32 PM, Dan Book <gri...@gmail.com> wrote: > Try this: https://metacpan.org/pod/Mojolicious::Guides:: > Rendering#Custom-responses > > On Thu, Apr 5, 2018 at 2:26 PM, Caveman Pl <caveman...@gmail.com> wrote: > >> Hi group, >> >> I have no idea how to export images located outside of public directory. >> Forgive me to disturbing groups such a lame questions but cant find >> working example with google... >> >> I have a route >> >> $r->get('/pdataexport_qc')->to('Pdataexport#showQC'); >> $r->post('/showqcshowimg')->to('Pdataexport#showQCshowIMG'); >> >> in my Pdataexport.pm >> >> sub showQC{ >> my $self = shift; >> my $pDataPath = $self->config('phenotypeDataFromResoraDbFilesPath'); >> my $dir = $self->param('dir'); >> $self->stash( dirToQC => $dir); >> $self->render('phenotypeExport/showDataQC'); >> } >> >> my template phenotypeExport/showDataQC.html.ep >> >> >> % layout 'all'; >> <table border="0" style="border-collapse: collapse;"> >> <tr><td><img src="https://192.168.11.11:1777/showqcshowimg?dir=<%=$dirToQ >> C%>&img=AH1vsAGE.png"></td></tr> >> </table> >> </body> >> </html> >> >> which generates me nice url >> <table border="0" style="border-collapse: collapse;"> >> <tr><td><img src="https://192.168.11.11:1777/showqcshowimg?dir=2018-04- >> 03-18-32-46_G&img=AH1vsAGE.png"> >> </table> >> </table> >> >> >> but in log output I can see that was not routed to showqcshowimg >> sub showQCshowIMG { >> my $self = shift; >> my $img = $self->param('img'); >> my $dir = $self->param('dir'); >> my $pDataPath = $self->config('phenotypeDataFromResoraDbFilesPath'); >> $self->render_file(filepath => $pDataPath.$dir."/".$img, 'filename' >> => $img ); >> } >> >> Can you give a simpe example how it should be done? >> or maybe you know page or open project which can play as example? >> >> Thank you, >> tj >> >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Mojolicious" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to mojolicious+unsubscr...@googlegroups.com. >> To post to this group, send email to mojolicious@googlegroups.com. >> Visit this group at https://groups.google.com/group/mojolicious. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.