Reply
Thread Tools
speculatrix's Avatar
Posts: 880 | Thanked: 264 times | Joined on Feb 2007 @ Cambridge, UK
#11
I'd simply set up a web server which served a page with a meta refresh, and referenced a random image from a collection. It might need to do some scaling on the fly. Then just point the tablet at the web server!

Hmm, I like that idea, might have a hack at it myself!
 
speculatrix's Avatar
Posts: 880 | Thanked: 264 times | Joined on Feb 2007 @ Cambridge, UK
#12
OK, here's a very quick hack.
Code:
#!/usr/bin/perl -w

use strict;
use CGI qw(:standard);

my $TIMEOUT = 20;
my @IMAGEDIRS = ('/xxxx', '/yyyy'); # FIXME

#### check the function
my $p_function = defined(param('function')) ?  param('function') : '';
my $p_device = defined(param('device')) ?  param('device') : '';

if ($p_function eq 'picture')
{
    chdir $IMAGEDIRS[rand($#IMAGEDIRS)];;

    # FIXME according to your image directories
    my @sub1Dirs = <*>;
    my $sub1Dir = '';
    while ($sub1Dir !~ /^\d+\d+\d+\d+$/)
    {
        $sub1Dir = @sub1Dirs[rand($#sub1Dirs)];
    }
    chdir $sub1Dir;

    my @sub2Dirs = <*>;
    my $sub2Dir = @sub2Dirs[rand($#sub2Dirs)];
    chdir $sub2Dir;

    my @pictures = <*.jpg>;
    my $picture = @pictures[rand($#pictures)];

    #if (0)
    if (open(FH, "<$picture"))
    {
        print "Content-type: image/jpeg\n\n";
        while (<FH>)
        {
                print $_;
        }
        close(FH);
        print "\n";
    }
    else
    {
        print "Content-type: text/plain\n\nERROR!\n";
        print "sub1Dirs list is " . join (', ', @sub1Dirs) . "\n";
        print "sub1Dir chosen was $sub1Dir\n";
        print "sub2Dirs list is " . join (', ', @sub2Dirs) . "\n";
        print "sub2Dir chosen was $sub2Dir\n";
        print "picture list is " . join (', ', @pictures) . "\n";
        print "picture file name is '$picture' \n";
    }
}
else
{
    print "Content-type: text/html\n\n";

    print "<html><head>\n<meta http-equiv=\"refresh\" content=\"$TIMEOUT\">";
    #print `date` . "<br />\n";
    print "<img src=\"?function=picture\"";
    if ($p_device eq 'tablet')
    {
        print " width=\"800\" height=\"480\" ";
    }
    print "/>";

    print "</body>\n</html>\n";
}
 
speculatrix's Avatar
Posts: 880 | Thanked: 264 times | Joined on Feb 2007 @ Cambridge, UK
#13
I added automagic image scaling to make the pictures fit.. it's a bit too big to post here, get it at
http://www.zaurus.org.uk/download/scripts/picture

you'd access it, by the way, as something like http://myserver/cgi-bin/picture?device=tablet (miss off the device= for 800x600 scaled pictures)
 

The Following User Says Thank You to speculatrix For This Useful Post:
Posts: 7 | Thanked: 2 times | Joined on May 2008 @ Toronto
#14
Thanks for all the great suggestions/solutions. I love how responsive this community is. thanks again all!
 
Reply


 
Forum Jump


All times are GMT. The time now is 07:05.