ePages 6.11.0 - DE_EPAGES/Presentation/Scripts/Sprites/SpriteUtil.pm

Package DE_EPAGES::Presentation::Scripts::Sprites::Util

Utility class for Sprite Composer

Package DE_EPAGES::Presentation::Scripts::Sprites::SpriteUtil

@EXPORT_OK
ReadConfigFile
MergeOptions
PngCrush
OptiPng
ReplaceMarkers

Functions

MergeOptions
OptiPng
PngCrush
ReadConfigFile
ReplaceMarkers

MergeOptions

Merges options from command line with options from configuration file

Example
my $hMergedOptions = MergeOptions(\%CommandLineOptions, $hConfigFileOptions);
Input
$hCommandLineOptions (ref to hash)
command line options
$hConfigFileOptions (ref to hash)
options from config file
Return
\%Result (ref to hash)
merged options

OptiPng

Apply external OptiPng application to optimize the file size of the final png image. Uses executeable version of OptiPng via SystemCommand.

Example
$self->OptiPng("C:\\temp\\test.png");
my $SavedInPercent = $self->OptiPng("C:\\temp\\test.png");
Input
$ActualFullFileName (string)
full file path-name of the image to optimize
$hOptions (ref.hash)
options
  • debug - (optional) output debug messages
  • quiet - (optional) silent optipng
  • optipngmethod - (required) use this optipng method
  • lowerlimit - (optional) use optimized images with at least
    that amount of saving (i.e. 10%)

Return
(float)
-1 if the OptiPng application failed, 0 if the image could not be
optimized further, otherwise the rate of saved file size in per cent

PngCrush

Apply external pngcrush application to optimize the file size of the final png image. Uses executeable version of pngcrush via SystemCommand. See also: http://sourceforge.net/projects/optipng/ http://sourceforge.net/projects/pmt/

Example
$self->PngCrush("C:\\temp\\test.png");
my $SavedInPercent = $self->PngCrush("C:\\temp\\test.png");
Input
$ActualFullFileName (string)
full file path-name of the image to optimize
$hOptions (ref.hash)
options
  • pngcrushmethod - (required) use this pngcrush method
  • debug - (optional) output debug messages

Return
(float)
-1 if the pngpng application failed, 0 if the image could not be
optimized further, otherwise the rate of saved file size in per cent

ReadConfigFile

Reads config parameters from given file

Example
my $hConfigFileOptions = $class->ReadConfigFile(__FILE__);
Input
$FileName (string)
name of the config file
Return
$hConfigValues (ref to hash)
hash with the configuration values

ReplaceMarkers

Replace the markers with ENV variable values or the given option values.

Example
$TargetFileName = ReplaceMarkers(
  $self->{'csstargetdirectoryrelative'}.CorrectPathSlashes('/').$TargetFileName,
  {'cartridge' => $CartridgeName}
);
Input
$Text (string)
string containing markers
$hOptions (ref to hash)
optional parameters with marker name-value pairs
Return
$Text (string)
updated string