Consolidate cover resize logic

Moves resizing out of the MusicBrainz namespace to Records - which
improves division of responsibilities, and removes double resizing
during import.
This commit is contained in:
Claudio Ortolina
2024-11-26 08:35:16 +00:00
parent 5cb2214922
commit f0212eeb6f
6 changed files with 32 additions and 26 deletions
+6
View File
@@ -0,0 +1,6 @@
defmodule MusicLibrary.Records.Cover do
def resize(cover_data) do
{:ok, thumb} = Vix.Vips.Operation.thumbnail_buffer(cover_data, 600)
Vix.Vips.Image.write_to_buffer(thumb, ".jpg")
end
end