-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat: Create a favicon for an artist based on their avatar #912
base: main
Are you sure you want to change the base?
feat: Create a favicon for an artist based on their avatar #912
Conversation
Added the sharp-ico package and tried to generate a favicon based on the artist avatar we have.
👷 Deploy request for mirlo pending review.Visit the deploys page to approve it
|
Fixed comment to match JS style comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing, thanks for doing this!
Added a comment that i think should help
src/jobs/optimize-image.ts
Outdated
@@ -148,6 +150,17 @@ const optimizeImage = async (job: Job) => { | |||
data: { url: urls }, | |||
}); | |||
} else if (model === "artistAvatar") { | |||
// TODO: where should the favicon be stored |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can store it on minio, for which there's a utility library in minio.ts
.
You can see an example of it being used here https://github.com/funmusicplace/mirlo/pull/912/files#diff-115f11f048b07ecdfa25349373f3479306ff732a6f8185f5590f98f114d211dbR114
Added call to upload the artist avatar favicon to the Minio store and some logging to indicate when it happens
src/jobs/optimize-image.ts
Outdated
artistFavicon = ico.sharpsToIco([sharp(buffer)], "artist_avatar.ico", { | ||
sizes: [48], | ||
resizeOptions: {}, | ||
}); | ||
logger.info("Uploading artist avatar favicon to bucket"); | ||
const faviconFinalName = `${destinationId}_favicon.ico`; | ||
await minioClient.putObject( | ||
finalMinioBucket, | ||
faviconFinalName, | ||
artistFavicon | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simonv3 I've tried to store the favicon in Minio as you suggested. Let me know if I got it right 😅 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks good! If you're running this locally, you can check to see if it ended up there, instructions on how to access it here: https://github.com/funmusicplace/mirlo?tab=readme-ov-file#minio
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the artistFavicon variable since the return value of the ico method is the size, width and height properties of the favicon. Switch to setting the file name as a variable and use that when saving the favicon to the Minio bucket.
Fixes #330