Automatic Picture Upload For Tiltviewer Gallery

Want to support HowtoForge? Become a subscriber!
 
Submitted by haimari1 (Contact Author) (Forums) on Tue, 2008-06-17 11:24. :: Other

Automatic Picture Upload For Tiltviewer Gallery

If you are using Tiltviewer you probably know that if you want to upload let's say 10 new pictures you have to edit manually the Gallery.xml file and enter each filename and attribute by hand. This is very frustrating.

This small script will do this automatically for you: just put the file in the right directory, change this script accordingly and you are good to go !

#!/usr/bin/perl

system ("/bin/cat /dev/null >gal.xml");

open (XML, ">>gal.xml");
my $somedir = './imgs';
opendir DH, $somedir or die "Cannot open $somedir: $!";
my @files = grep { ! -d } readdir DH;
closedir DH;

print XML "<tiltviewergallery>
        <photos>";


        foreach (@files) {
                chomp $_;
                my $file = $_;
                print XML "<photo imageurl=\"imgs/$file\" linkurl=\"http://mydomain/imgs/$file\"
                         showFlipButton=\"true\">
                                     <title>\"$file\"</title>
                                                    <description>\"$file\"</description></photo>";


                }

                       print XML "</photos>
                        </tiltviewergallery>";

Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Paul (not registered) on Tue, 2009-03-24 05:31.

Which directory and what would you name the file???

Paul

Submitted by Sky (not registered) on Wed, 2010-06-09 04:58.
Another great script rendered worthless because the author failed to answer the simplist of questions, such as what you name this file?  Where to place it?  does it it get added into one of the present tiltviewer files?  Sad....