$newSize =
[ 'width' =>
$maxWidth,
'height' =>
$maxHeight,
];
if ($keepProportions) { $newSize =
$this->
calculateProportionalThumbnailSize($originalSize,
$maxWidth,
$maxHeight);
} $newImage =
$this->
createNewImage($image,
$originalSize,
$newSize,
$this->
getImageExtension($destination));
if ($this->fixGdImageBlur
) { $this->
fixGdImageBlur($newSize,
$newImage);
} $this->
saveImage($destination,
$newImage,
$quality);
$this->
optimizeImage($destination);
// Removes both the original and the new created image from memory
imagedestroy($newImage);
imagedestroy($image);
}