app\models\Album::copyCoverFile PHP Méthode

copyCoverFile() public méthode

Copy a cover file from an existing image on the system.
public copyCoverFile ( string $srcPath )
$srcPath string The original image's full path.
    public function copyCoverFile($srcPath)
    {
        $extension = pathinfo($srcPath, PATHINFO_EXTENSION);
        $destPath = $this->generateRandomCoverPath($extension);
        copy($srcPath, $destPath);
        $this->update(['cover' => basename($destPath)]);
    }