Automatic Picture Upload For Tiltviewer Gallery
Want to support HowtoForge? Become a subscriber!
Automatic Picture Upload For Tiltviewer GalleryIf 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>";
|



Recent comments
1 day 16 hours ago
1 day 18 hours ago
2 days 6 hours ago
2 days 9 hours ago
2 days 13 hours ago
2 days 19 hours ago
3 days 4 hours ago
3 days 6 hours ago
3 days 14 hours ago
3 days 16 hours ago