Added imagekit optimization support

This commit is contained in:
2025-07-29 17:52:39 +03:30
parent 48b893a403
commit 051408fcdd
6 changed files with 43 additions and 5 deletions

View File

@@ -0,0 +1,20 @@
package services
import "CatsOfMastodonBotGo/internal/config"
type ImgKitHelper struct {
}
var ImgKitHelperInstance *ImgKitHelper
func InitImgKitHelper() {
ImgKitHelperInstance = &ImgKitHelper{}
}
func GetPreviewUrl(url string) string {
return "https://ik.imagekit.io/" + config.Config.ImageKitId + "/tr:w-500,h-500,c-at_max,f-webp,q-60/" + url
}
func GetRemoteUrl(url string) string {
return "https://ik.imagekit.io/" + config.Config.ImageKitId + "/tr:q-70,dpr-auto,f-webp/" + url
}