mirror of
https://github.com/netfun2000/lcd4linux.git
synced 2026-02-27 09:44:34 +08:00
added PNG,Webinterface git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@91 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
42 lines
987 B
Perl
Executable File
42 lines
987 B
Perl
Executable File
#!/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;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|