public function copyImage($fromImagePath, $toImagePath)
{
if (!is_file($fromImagePath)) {
throw new InvalidFileException("This is not a valid image: " . $fromImagePath);
}
if (!is_dir(dirname($toImagePath))) {
mkdir(dirname($toImagePath), 0755, true);
}
if (!file_exists($toImagePath)) {
copy($fromImagePath, $toImagePath);
}
return $toImagePath;
}