CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Can I return an image?

 



kencl
User

Jan 22, 2001, 9:10 PM

Post #1 of 1 (332 views)
Can I return an image? Can't Post

I want to log page views and click throughs on banner images. I though of putting this in the HTML:


Code
<a href="http://domain/cgi-bin/logbanner.pl?id=238&view=0"> 
<img src="http://domain/cgi-bin/logbanner.pl?id=238&view=1" width="120" height="60" border="0">
</a>

then in logbanner.pl:


Code
%Log = &GetFormInput;  # subroutine returns hash with formfield names as keys and values as values 
if ($Log{"view"} { # view is 1 in the image request and 0 when the link is clicked
&LogView($Log{"id"});
$Imagefilename = &FindImage($Log{"id"}); Returns absolute URL to banner image (IE "http://domain.com/banners/thisbanner.gif")
print "Content-Type: image/gif\n\n";
print $imagefilename;
} else {
&LogClickThrough($Log{"id"});
$SendTo = &GetForwardingURL($Log{"id"}); # returns an absolute URL including protocol (IE "http://wherever.com")
print "Content-Type: text/html\n\n";
print "<html><head><script Language="JavaScript">location.href='$SendTo'</script></head><body>forwarding now</body>";
}

Does this seem feasable? Will the returned image embed itself properly into the page which called it, or replace the page?

Thanks in advance :)


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives