Gossamer Forum
Home : General : Perl Programming :

calling an image from CGI

Quote Reply
calling an image from CGI
I'm working on a web log program for Links. I want to use an image tag to call the stats program to avoid using SSI, IFRAME, or ILAYER. I know this can be done, but how? The current code is at: http://ucmd.virtualave.net/links_mods/stats.txt

BTW: the image is a static, transparent gif, not a dynamic graphical counter.

Thanks in advanced,

--Drew
Quote Reply
Re: calling an image from CGI In reply to
umm... 'avoid using ssi'..

looks like a script for ssi to me..

so exactly what is your problem??

Jerry Su
Quote Reply
Re: calling an image from CGI In reply to
But what happens once I'm not in my root url? The only way I can get it to work with ssi is with <!--#include virtual="cgi-bin/stats.cgi?home" -->. Absolute paths won't work, and neither will URLS. I know you can go back a few folders with "../../" or whatever but how would I generate the code for that? With exec cmd you can do absolute paths, but you can't pass parameters, and exec cgi is disabled. That's why I don't want to use SSI.

--Drew
Quote Reply
Re: calling an image from CGI In reply to
Use !--#exec cgi="/cgi-bin/stats.cgi?home"--.

Regards,

Eliot

Quote Reply
Re: calling an image from CGI In reply to
Well I got it work finally, without SSI. I needed to remove the content-type and use print "Location: $image"; to redirect to the image.

--Drew
Quote Reply
Re: calling an image from CGI In reply to
You should probably do a:

print "Content-type image/gif\n\n";
open (IMG, "/path/to/img") or die $!;
while (<IMG>) { print; }
close IMG;

that way it saves another call to the server.

Cheers,

Alex


--
Gossamer Threads Inc.
Quote Reply
Re: calling an image from CGI In reply to
Thanks Alex, I'll see about that method. My problem now is that $ENV{'HTTP_REFERER'} returns the name of the page that called the script, not the last page visted. Anyone know how to go get the last x sites a user visited to get to your site?

--Drew