Changeset 15177

Show
Ignore:
Timestamp:
09.04.2008 17:17:53 (11 years ago)
Author:
ak19
Message:

On Linux, image file sizes can be given in the form 3.4e+02kb (3.4 x 1 x 102=340kb). The modifications to ImagePlug?.pm now match this and store the size when given in this form rather than the size defaulting to the unknown string.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/plugins/ImagePlug.pm

    r14960 r15177  
    332332    } 
    333333    } 
    334  
     334    elsif ($result =~ m/^.* (([0-9]+)(\.([0-9]+))?e\+([0-9]+))(kb|b)?/) { 
     335    # Deals with file sizes on Linux of type "3.4e+02kb" where e+02 is 1*10^2. 
     336    # 3.4e+02 therefore evaluates to 3.4 x 1 x 10^2 = 340kb. 
     337    # Programming languages including Perl know how that 3.4e+02 is a number, 
     338    # so we don't need to do any calculations. 
     339    $size = $1*1; # turn the string into a number by multiplying it by 1 
     340           #if we did $size = $1; $size would be merely the string "3.4e+02" 
     341    $size = int($size); # truncate size 
     342    } 
    335343    print $outhandle "file: $image:\t $type, $width, $height, $size\n"  
    336344    if ($verbosity > 2);