Added imagekit optimization support
This commit is contained in:
20
internal/services/imgKitHelper.go
Normal file
20
internal/services/imgKitHelper.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user