我的 Google fu 让我失望了。如何使用 Perl 提供已生成的图像?
Example:
<html><body><img src="getimage.pl"></body></html>
getimage.pl 里有什么?
干得好:
#!/usr/bin/perl -w
my $file = "inner-nav.gif";
## my $length = (stat($file)) [10];
## (stat($file)) [10]; is the inode change time in seconds since 00:00 January 1, 1970 GMT.
my $length = (stat($file)) [7];
print "Content-type: image/gif\n";
print "Content-length: $length \n\n";
binmode STDOUT;
open (FH,'<', $file) || die "Could not open $file: $!";
my $buffer = "";
while (read(FH, $buffer, 10240)) {
print $buffer;
}
close(FH);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)