Ignore:
Timestamp:
Jul 30, 2010, 9:11:57 AM (14 years ago)
Author:
ronosman
Message:

Clean up image files from cache when exiting.

Location:
extensions/pLoader/trunk/src/Uploader
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/pLoader/trunk/src/Uploader/GUI/App.pm

    r6726 r6737  
    190190    $self->store_all;
    191191
     192    # clean image files
     193    $self->remove_dir_files($self->thumb_dir);
     194    $self->remove_dir_files($self->resized_dir);
     195
    192196}
    193197
     
    202206}
    203207
     208
     209sub remove_dir_files {
     210    my ( $self, $dir_name ) = @_;
     211
     212    if(opendir(DIR, $dir_name)){
     213        while(defined(my $file_name = readdir(DIR))){
     214            my $filepath =  File::Spec->catfile(
     215                $dir_name,
     216                $file_name
     217            );
     218            unlink $filepath;
     219        }
     220
     221        closedir(DIR);
     222    }
     223}
    204224
    205225sub reset_add_rank {
  • extensions/pLoader/trunk/src/Uploader/ResizeWorker.pm

    r6726 r6737  
    483483        # high file is the original file
    484484        $image->{site_high_file} = $image->{file};
    485         #printf("site high file %s\n", $self->current_image->site_high_file);
    486485    }
    487486    $self->log_image_progress(
Note: See TracChangeset for help on using the changeset viewer.