Use two more references
parent
cfc8911b77
commit
09e3b77453
|
@ -19,7 +19,7 @@ type Tinify struct {
|
||||||
key string
|
key string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t Tinify) Compress(url string) (location string, err error) {
|
func (t *Tinify) Compress(url string) (location string, err error) {
|
||||||
fileExtension := func() string {
|
fileExtension := func() string {
|
||||||
spliced := strings.Split(url, ".")
|
spliced := strings.Split(url, ".")
|
||||||
return spliced[len(spliced)-1]
|
return spliced[len(spliced)-1]
|
||||||
|
|
|
@ -26,7 +26,7 @@ type BunnyCdnStorage struct {
|
||||||
|
|
||||||
var bunnyCdnStorageUrl = "https://storage.bunnycdn.com"
|
var bunnyCdnStorageUrl = "https://storage.bunnycdn.com"
|
||||||
|
|
||||||
func (b BunnyCdnStorage) Upload(fileName string, file multipart.File) (location string, err error) {
|
func (b *BunnyCdnStorage) Upload(fileName string, file multipart.File) (location string, err error) {
|
||||||
client := &http.Client{}
|
client := &http.Client{}
|
||||||
req, _ := http.NewRequest(http.MethodPut, bunnyCdnStorageUrl+"/"+url.PathEscape(b.storageZoneName)+"/"+url.PathEscape("/"+fileName), file)
|
req, _ := http.NewRequest(http.MethodPut, bunnyCdnStorageUrl+"/"+url.PathEscape(b.storageZoneName)+"/"+url.PathEscape("/"+fileName), file)
|
||||||
req.Header.Add("AccessKey", b.key)
|
req.Header.Add("AccessKey", b.key)
|
||||||
|
|
Loading…
Reference in New Issue