[NTLUG:Discuss] Linux, Perl, CGI, Background attribute...
Greg Hewett
ghewett at d-techcorp.com
Wed Jul 18 08:27:21 CDT 2001
When I say absolute path, I mean the path in relation to document root. i.e
http:/serverA/pictures/image.jpg is an absolute path, and /pictures/image.jpg
is an absolute path for a file on serverA. The real path to these files is
/usr/local/apache/htdocs/pictures/image.jpg or
/home/httpd/html/pictures/image.jpg.
If you have an html file that is located at /application/index.html, and you
are calling a cgi at /cgi-bin/script.cgi, when you want to display the image
/application/images/image.jpg, you should use the url /images/application/image.jpg or ../application/images/image.jpg. Adding Aliases into the mix makes things a little more abstract because the path is determined by the way that apache displays the file system, and not how the files are arranged on the file system.
Try to display the same image in an <img> tag, and see if you are able to do
that. You will be able to see the path that your browser is trying to use for
the image.
Greg
On Tue, Jul 17, 2001 at 05:37:30PM -0500, Fred James wrote:
> The relative path is required due to ownership of files below "document
> root", but the relative path is in relationship to the caller in any
> case.
> Is this an indication of a possible set up issue in the (Apache) web
> server?
> Remember - It works form straight HTML, but not in HTML generated by
> *.cgi (with or without CGI.pm) - of course the image file is currently
> in the same directory as the straight HTML file.
>
> Greg Hewett wrote:
> >
> > You might want to try an absolute path to you image.
> >
> > <body background="/images/image.jpg">
> >
> > When you start using the "../" you have to be very careful. the relational
> > path will be the relational path from your cgi not the page that called it.
> >
> > On Tue, Jul 17, 2001 at 04:07:57PM -0500, Fred James wrote:
> > > Page source looks like this:
> > > (code omitted)
> > > <BODY BACKGROUND="../path/image.jpg">
> > > (code omitted)
> > > and it doesn't work, though the this one for color does:
> > > (code omitted)
> > > <BODY BGCOLOR="orange">
> > > (code omitted)
> > >
> > > MadHat wrote:
> > > >
> > > > At 12:55 PM 7/17/2001 -0500, you wrote:
> > > > >The HTML BODY tag attribute BACKGROUND, points to the url of a graphic
> > > > >file to use as the (tiled) background for the page.
> > > > >
> > > > ><BODY BACKGROUND="url">
> > > > >
> > > > >I have this to working in an *.HTML file, But I have not been able to do
> > > > >so in a Perl *.cgi file, with or without the CGI.pm
> > > > >
> > > > >Any pointers would be appreciated.
> > > >
> > > > when you views the source what do you see? How are you trying to use it in
> > > > the CGI?
> > > >
> > > > print "<BODY BACKGROUND=\"url\">\n";
> > > >
> > > > or
> > > >
> > > > use CGI qw/:standard/;
> > > > print start_html(-title=>'test page',
> > > > -body=>{-background=>'url',
> > > > -bgcolor=>'white'});
> > > >
> > > > >--
> > > > >...make every program a filter...
> > > > >_______________________________________________
> > > > >http://www.ntlug.org/mailman/listinfo/discuss
> > > >
> > > > --
> > > > MadHat at unspecific.com
> > > >
> > > > _______________________________________________
> > > > http://www.ntlug.org/mailman/listinfo/discuss
> > >
> > > --
> > > ...make every program a filter...
> > > _______________________________________________
> > > http://www.ntlug.org/mailman/listinfo/discuss
> > _______________________________________________
> > http://www.ntlug.org/mailman/listinfo/discuss
>
> --
> ...make every program a filter...
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
More information about the Discuss
mailing list