blob: d06df1b3914ee7931c6ed8539d669c7e54820e7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
When the camera frame is /im/ {
Wish the web server handles route "/frame-image/$" with handler [list apply {{im} {
# set width [dict get $im width]
# set height [dict get $im height]
set filename "/tmp/web-image-frame.jpg"
image saveAsJpeg $im $filename
set fsize [file size $filename]
set fd [open $filename r]
fconfigure $fd -encoding binary -translation binary
set body [read $fd $fsize]
close $fd
dict create statusAndHeaders "HTTP/1.1 200 OK\nConnection: close\nContent-Type: image/jpeg\nContent-Length: $fsize\n\n" body $body
}} $im]
}
|