1 # Simple Photo Gallery: Web Archiver
2 # (c) 2005 Martin Mares <mj@ucw.cz>
4 package Gallery::Archive;
5 import Gallery qw(%CF);
10 my ($cls, $type) = @_;
11 my $x = { 'type' => $type, 'files' => [] };
17 my $type = $this->{'type'};
18 my $cts = { "tar" => "application/x-tar", "zip" => "application/zip" };
19 defined $cts->{$type} or die "Unknown archive type $type";
20 print "Content-Type: ", $cts->{$type}, "\n";
21 print "Content-Disposition: inline;filename=gallery.$type\n";
27 my $type = $this->{'type'};
29 chdir($CF{"PhotoDir"}) or die;
31 system("tar", "cf", "-", @{$this->{'files'}});
32 } elsif ($type eq "zip") {
33 system("zip", "-q", "-", @{$this->{'files'}});
41 my ($this, $orig, $annot) = @_;
42 push @{$this->{'files'}}, $orig;