aboutsummaryrefslogtreecommitdiffstats
path: root/nph-png
diff options
context:
space:
mode:
authorltoetsch <ltoetsch@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2001-03-01 15:11:30 +0000
committerltoetsch <ltoetsch@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2001-03-01 15:11:30 +0000
commit4e1dbe89f4ef1f6c8086991e68c1566aae22c467 (patch)
tree0f39e041e461437ed275db79c913d668af9026bd /nph-png
parent8785427f310078d20860008a6202071b25bff75e (diff)
downloadlcd4linux-4e1dbe89f4ef1f6c8086991e68c1566aae22c467.tar.gz
[lcd4linux @ 2001-03-01 15:11:30 by ltoetsch]
added PNG,Webinterface git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@91 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'nph-png')
-rwxr-xr-xnph-png41
1 files changed, 41 insertions, 0 deletions
diff --git a/nph-png b/nph-png
new file mode 100755
index 0000000..0240b64
--- /dev/null
+++ b/nph-png
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+
+use strict;
+use vars qw ($file $DELAY);
+########## CONFIG
+ $file = "lcd4linux"; # .png is appended
+ $DELAY = 0; # delay in seconds
+ # if delay is zero, file is sent when modified.
+#################
+
+use CGI qw/:push -nph/;
+$| = 1;
+my ($mtime, $nmtime, $size, $nsize);
+(undef, undef, undef, undef, undef, undef, undef, $size, undef,
+ $mtime) = stat "$file.png";
+print multipart_init(-boundary=>'----------------here we go!');
+while (1) {
+ print multipart_start(-type=>'image/png');
+ undef $/;
+ open(IN, "$file.png") or die("Can't read '$file.png'");
+ $_ = <IN>;
+ print $_;
+ close(IN);
+ print multipart_end;
+ if ($DELAY) {
+ sleep $DELAY;
+ }
+ else {
+ W: while (1) {
+ # sleep(1);
+ (undef, undef, undef, undef, undef, undef, undef, $nsize, undef,
+ $nmtime) = stat "$file.png";
+ if($mtime != $nmtime || $size != $nsize) {
+ $mtime = $nmtime;
+ $size = $nsize;
+ last W;
+ }
+ }
+ }
+}
+