Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in 'php artisan koel:sync' because '/covers' subdirectory of 'public/img/' is not created by default #572

Closed
nitePhyyre opened this issue Apr 13, 2017 · 1 comment

Comments

@nitePhyyre
Copy link

Hi,

I had a fresh install of 3.6.0.
In file app/Models/Album.php:

public function copyCoverFile($srcPath)
{
    $extension = pathinfo($srcPath, PATHINFO_EXTENSION);
    $destPath = $this->generateRandomCoverPath($extension);
    copy($srcPath, $destPath);
    $this->update(['cover' => basename($destPath)]);
}

private function generateRandomCoverPath($extension)
{
    return app()->publicPath().'/public/img/covers/'.uniqid('', true).".$extension";
}

The line copy($srcPath, $destPath); is causing the following error:
[ErrorException] copy(/var/www/public/img/covers/58eeea295471a5.02522229.jpg): failed to open stream: No such file or directory

Because while app()->publicPath().'/public/img/' existed on the new install. The /covers subdirectory didn't. Creating the directory allowed me to run the import.

@etbusch
Copy link

etbusch commented Apr 14, 2017

Also encountered this bug

@phanan phanan closed this as completed in 9aa77f1 Apr 15, 2017
javier-lopez pushed a commit to javier-lopez/koel that referenced this issue Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants