sub processing { my %upload; my $upload = "gal.db"; tie %upload, "DB_File", "$gal", O_CREAT | O_RDWR, 0644, $DB_BTREE or die "Cannot open file 'gal': $!\n"; ### # Setup our params ### my $edit = url_param('edit'); my $del = url_param('rem'); #################### # Check for DELETE call #################### if ($del ne "") { if (exists $upload{$del}) { my ( $filename, $title, $comments, $width, $height, $count ) = split ( /::/, $upload{$del} ); ### # Rewriting $filename to a .png ### my $thumbs = $filename; $thumbs =~ m/([a-zA-Z0-9]+)\.()/; $thumbs = "$1.png"; ### # Deleting files from both image folders ### delete $upload{$del}; unlink "$fullimagedir/$filename" or die "Cannot delete image: $!"; unlink "$fullthumbsdir/$thumbs" or die "Cannot delete image: $!"; print "
Image removed.
"; my $num = "-1"; foreach (sort keys %upload) { $num++; my ( $filename2, $title2, $comments2, $width2, $height2, $count2 ) = split ( /::/, $upload{$_} ); my $joined = join("::", $filename2, $title2, $comments2, $width2, $height2, $count2); $upload{$num} = $joined; print "$num = $joined
"; } my $count = "-1"; foreach (sort keys %upload) { $count++; } print "$count"; delete $upload{$count}; } else { print "
ERROR! Image does not exist.
"; }