protected function determineOutputFormat($pathToImage)
{
$outputFormat = pathinfo($pathToImage, PATHINFO_EXTENSION);
if ($this->outputFormat != '') {
$outputFormat = $this->outputFormat;
}
$outputFormat = strtolower($outputFormat);
if (!$this->isValidOutputFormat($outputFormat)) {
$outputFormat = 'jpg';
}
return $outputFormat;
}