Devise\Media\Images\Images::copyImage PHP Method

copyImage() public method

Copies an image from one location to another location, also handles creating sub directories if they don't already exist for us
public copyImage ( string $fromImagePath, string $toImagePath ) : string
$fromImagePath string
$toImagePath string
return string
    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;
    }