[GH-ISSUE #40] How does Koel get album / artist covers? #28

Closed
opened 2026-02-26 02:31:51 +03:00 by kerem · 4 comments
Owner

Originally created by @askoxyz on GitHub (Dec 14, 2015).
Original GitHub issue: https://github.com/koel/koel/issues/40

So far it has managed to get no covers for any albums and/or artists I have, while they do show up in any other media player, so hence my question, how does Koel get the album covers, or how does it fetch them? from the song meta data or from a 3rd party (e.g last.fm or something)?

Originally created by @askoxyz on GitHub (Dec 14, 2015). Original GitHub issue: https://github.com/koel/koel/issues/40 So far it has managed to get no covers for any albums and/or artists I have, while they do show up in any other media player, so hence my question, how does Koel get the album covers, or how does it fetch them? from the song meta data or from a 3rd party (e.g last.fm or something)?
kerem closed this issue 2026-02-26 02:31:51 +03:00
Author
Owner

@askoxyz commented on GitHub (Dec 14, 2015):

Ok so I see it does all of this in Album.php#L68, but doesn't seem to actually work tough. Any thoughts?

<!-- gh-comment-id:164574152 --> @askoxyz commented on GitHub (Dec 14, 2015): Ok so I see it does all of this in [Album.php#L68](https://github.com/phanan/koel/blob/master/app/Models/Album.php#L68), but doesn't seem to actually work tough. Any thoughts?
Author
Owner

@cgrossde commented on GitHub (Dec 14, 2015):

I also had some issues here: When importing Koel tries to put the images in /img/covers, a folder that does not exist at the time. When accessing the covers it looks at /public/img/covers. The problem is, that this Laravel project is setup to have the index.php and .htaccess in / instead of /public. Therefore Laravel thinks the public_path() is / and not /public.

Quick fix: Change link 72 in Album.php to

$coverPath = public_path().'/public/img/covers/'.$fileName;

Clear the DB and reimport your music.

Better solution:

  • Move index.php and .htaccess to /public
  • Adapt templates and remove "public" path segment since public is the new root
  • Adapt your web servers docroot to the public folder and add the root folder to your include_path and open_basedir
  • Reimport your music
<!-- gh-comment-id:164592042 --> @cgrossde commented on GitHub (Dec 14, 2015): I also had some issues here: When importing Koel tries to put the images in `/img/covers`, a folder that does not exist at the time. When accessing the covers it looks at `/public/img/covers`. The problem is, that this Laravel project is setup to have the `index.php` and `.htaccess` in `/` instead of `/public`. Therefore Laravel thinks the `public_path()` is `/` and not `/public`. **Quick fix:** Change link [72](https://github.com/phanan/koel/blob/master/app/Models/Album.php#L72) in [Album.php](https://github.com/phanan/koel/blob/master/app/Models/Album.php#L72) to ``` PHP $coverPath = public_path().'/public/img/covers/'.$fileName; ``` Clear the DB and reimport your music. **Better solution:** - Move `index.php` and `.htaccess` to `/public` - Adapt templates and remove "public" path segment since public is the new root - Adapt your web servers docroot to the public folder and add the root folder to your include_path and open_basedir - Reimport your music
Author
Owner

@askoxyz commented on GitHub (Dec 14, 2015):

Yup. Went with the quick fix on this one and worked brilliantly. I do understand the use case for storing index and .htaccess in / instead of /public, for example shared hosts which do not allow anything up from public_html, but then public_path() should also be changed accordingly from the get-go. Either way, thank you @cgrossde .

<!-- gh-comment-id:164595785 --> @askoxyz commented on GitHub (Dec 14, 2015): Yup. Went with the quick fix on this one and worked brilliantly. I do understand the use case for storing index and .htaccess in `/` instead of `/public`, for example shared hosts which do not allow anything up from `public_html`, but then public_path() should also be changed accordingly from the get-go. Either way, thank you @cgrossde .
Author
Owner

@phanan commented on GitHub (Dec 14, 2015):

Thanks. Let's discuss in the PR.

<!-- gh-comment-id:164598629 --> @phanan commented on GitHub (Dec 14, 2015): Thanks. Let's discuss in the PR.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#28
No description provided.