Changeset 18474 for gsdl/trunk


Ignore:
Timestamp:
2009-02-09T14:34:27+13:00 (15 years ago)
Author:
mdewsnip
Message:

Fix to problem when using cached generated images where the image width and height metadata values were left undefined. Now saves the conversion result to a file (similar to what is done with the conversion arguments), and this is read when a cached image is used. By Jeffrey Ke at DL Consulting Ltd.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/convertutil.pm

    r16841 r18474  
    233233    print $outhandle "         This means $ofilename will be regenerated on next build whether\n";
    234234    print $outhandle "         processing args have changed or not.\n";
     235    }
     236
     237    # Store the result, since ImageConverter.pm extracts the image height and width from the processed result
     238    my $result_filename = "$ofilename.result";
     239    if (open(RESOUT, ">$result_filename"))
     240    {
     241    print RESOUT $result;
     242    close(RESOUT);
     243    }
     244    else
     245    {
     246    my $outhandle = $options->{'outhandle'};
     247    print $outhandle "Warning: Unable to write out cached process result to file $result_filename.\n";
    235248    }
    236249
     
    279292            print $outhandle "  $message_prefix: Cached file $ofile_no_dir already exists.\n";
    280293            print $outhandle "  $message_prefix: No need to regenerate $ofile\n" if ($verbosity > 2);
     294                   
     295                    # Read in the cached result lines and join them into a single string
     296                    my $result_filename = "$ofilename.result";
     297                    if (open(RESIN, "<$result_filename"))
     298            {
     299                      my @result_lines = <RESIN>;
     300                      $result = join("\n", @result_lines);
     301                      close(RESIN);
     302                    }
     303                    else
     304            {
     305                      print $outhandle "  $message_prefix: Error, failed to obtain cached result from $result_filename.\n";
     306                    }
    281307        }
    282308           
Note: See TracChangeset for help on using the changeset viewer.