app\models\Album::writeCoverFile PHP Method

writeCoverFile() public method

Write a cover image file with binary data and update the Album with the new cover file.
public writeCoverFile ( string $binaryData, string $extension )
$binaryData string
$extension string The file extension
    public function writeCoverFile($binaryData, $extension)
    {
        $extension = trim(strtolower($extension), '. ');
        $destPath = $this->generateRandomCoverPath($extension);
        file_put_contents($destPath, $binaryData);
        $this->update(['cover' => basename($destPath)]);
    }