Hi Stefan,
Yes they are static files outside dir tree generated by command "mojo
generate app" which is located in my home dir
/home/tomasz/work/mojo/my_app/.
I have tryed also inlib/MyApp.pm
use Mojolicious::Static;
my $static = Mojolicious::Static->new;
push @{$static->paths}, '/data/common/mojo/';
and than in phenotypeExport/showDataQC.html.ep
<img src="<%=$dirToQC%>/AH1vsAGE.png">
which create nice url in generated page
<img src="/data/common/mojo/2018-04-03-18-32-46_G/AH1vsAGE.png">
but it doesnt work also...
Thank you,
tj
W dniu czwartek, 5 kwietnia 2018 22:02:57 UTC+2 użytkownik Stefan Adams
napisał:
> I might be off base, but I'm wondering if what you're looking for is how
> to serve static files from a non default location?
>
> http://mojolicious.org/perldoc/Mojolicious#static
>
>
> On Thu, Apr 5, 2018, 2:19 PM Caveman Pl <[email protected] <javascript:>>
> wrote:
>
>> Hi Dan,
>>
>> Changing
>>
>> $r->post('/showqcshowimg')->to('Pdataexport#showQCshowIMG');
>>
>> to
>>
>> $r->get('/showqcshowimg')->to('Pdataexport#showQCshowIMG');
>>
>> doesn't help.
>>
>> Thank you,
>> tj
>>
>>
>> W dniu czwartek, 5 kwietnia 2018 20:34:07 UTC+2 użytkownik Dan Book
>> napisał:
>>
>>> 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 <[email protected]> wrote:
>>>
>>>> Try this:
>>>> https://metacpan.org/pod/Mojolicious::Guides::Rendering#Custom-responses
>>>>
>>>> On Thu, Apr 5, 2018 at 2:26 PM, Caveman Pl <[email protected]> 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=
>>>>> <%=$dirToQC%>&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 [email protected].
>>>>> To post to this group, send email to [email protected].
>>>>> 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 [email protected] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.