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

Shrink thumbnails on server side #16

Open
graue opened this issue Mar 14, 2013 · 5 comments
Open

Shrink thumbnails on server side #16

graue opened this issue Mar 14, 2013 · 5 comments

Comments

@graue
Copy link
Owner

graue commented Mar 14, 2013

When displaying albums in search results, Pots, fyi downloads the full size album artwork (which in some cases can be like 1600x1600 and 3MB), only to display it as a 50x50 thumbnail.

The server should create a 50x50 version before sending, possibly at a new endpoint like /albumart/<id>/thumb.

@tippenein
Copy link
Contributor

I use imagemagick to do this locally all the time.

convert cover.jpg -resize 50x50\> cover-thumb.jpg

The \> makes sure it doesn't enlarge anything which seems very unlikely, but w/e

It will add some more dependecies (imagemagick, libmagickcore-dev, libmagickwand-dev) but we can shrink the images if the libraries exist and leave them huge otherwise.

also, this reference

@graue
Copy link
Owner Author

graue commented Apr 21, 2013

Totally. I want to think about it carefully before we create any temp files. I'm thinking there should be a cache directory that holds both transcoded files and shrunken images. When a transcode or thumbnail is requested, if it's already cached, that gets sent as a static file; otherwise it's created on the fly and also saved in the cache. When the cache exceeds a total size, the file that hasn't been requested in the longest amount of time is deleted.

Do you know any readymade solutions for this? It's basically what Memcached does, but that only handles blobs up to 1 MB, big enough for thumbnails, but not for audio tracks.

@tippenein
Copy link
Contributor

Redis comes to mind since that's always mentioned in the same breathe as memcached. would you actually want to hold transcoded audio in memory? Seems like storing the path to the transcoded file and the time it was created/last used would be what we want.

In this scenario, does "cached" mean the file is saved as potsfyi/cache/file-<some-hash>.mp3 and stored in some database (redis?)

@graue
Copy link
Owner Author

graue commented Apr 22, 2013

Yes, that's what I mean... a cache on disk.

@graue
Copy link
Owner Author

graue commented Jun 16, 2015

The cache dir added in 4481460 could be used for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants