Mar 19, 2001, 4:56 PM
Post #1 of 3
I was wondering what the easiest method is to have an HTML tag for an image call a perl script and have it return the image.
where the image file on the server already exists in say a png format:
What perl script would I use (how do I set the mime type?) and how do I pass through a image formatted file?
here is what i found....
# counter cgi
# © 2000 Jackie Hamilton - http://www.cgi101.com/
# this cgi increments a counter in a file, then returns a gif image.
# (use either a small, 1-pixel "invisible" image, or your logo or something.)
# HTML code to call this:
# <img src="counter.cgi">
# this is good for use as a "hidden" counter within a page.
# note: be sure that the counter file is set WRITABLE by the httpd
# daemon owner or group. in Unix you'll need to 'chmod 775 countfile'
# or possibly 'chmod 777 countfile'.
$countfile = "cgicount";
$giffile = "small.gif";
$count = `cat $countfile`;
$count = $count + 1;
print INF "$count\n";
# if you're using a JPEG instead of a GIF, you should change this
# line to print type image/jpg.
@gifdata = `cat $giffile`;
# the end.
(This post was edited by mike_robb on Mar 19, 2001, 4:21 PM)