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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

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



Jan 22, 2001, 9:10 PM

Post #1 of 1 (372 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:

<a href="http://domain/cgi-bin/"> 
<img src="http://domain/cgi-bin/" width="120" height="60" border="0">

then in

%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
$Imagefilename = &FindImage($Log{"id"}); Returns absolute URL to banner image (IE "")
print "Content-Type: image/gif\n\n";
print $imagefilename;
} else {
$SendTo = &GetForwardingURL($Log{"id"}); # returns an absolute URL including protocol (IE "")
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