Changeset 31958

Show
Ignore:
Timestamp:
11.09.2017 09:53:59 (2 months ago)
Author:
kjdon
Message:

use identify to work out the filetype of the original file, rather than jsut using the file extension. it may not match eg .tif files should be tiff filetype.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/ImageConverter.pm

    r31926 r31958  
    152152 
    153153    my $self = new BaseMediaConverter($pluginlist, $inputargs, $hashArgOptLists, 1); 
    154  
    155  
     154   
    156155    return bless $self, $class; 
    157156 
     
    352351 
    353352    if ($self->{'store_original_image'} && $original_file_was_converted) { 
    354     # hack to guess the filetype 
    355     my ($orig_type) = ($original_filename_full_path =~ m/\.(.*?)$/); 
     353 
     354    # work out the file type 
     355    # use identify to get info about the original image 
     356    my ($orig_type, $orig_width, $orig_height, $orig_size, $origsize_str)  
     357    = &identify($original_filename_full_path, $outhandle, $verbosity); 
     358 
     359    if ($orig_type ne " ") { 
     360        $orig_type = $self->correct_mime_type($orig_type); 
     361    } 
     362 
    356363    # add the original image as an associated file 
    357364    $doc_obj->associate_file($original_filename_full_path, $original_filename_no_path, "image/$orig_type", $section);