Skip to content

Commit 9119eb2

Browse files
committed
fix images
1 parent 1d82d7e commit 9119eb2

File tree

8 files changed

+39
-43
lines changed

8 files changed

+39
-43
lines changed

devkit

-26.5 MB
Binary file not shown.

devkit-cli

-24.8 MB
Binary file not shown.

devkit-cli-refs.tags.v0.0.18.zip.1

-9.74 MB
Binary file not shown.

devkit-cli-refs.tags.v0.0.21.zip

-12.4 MB
Binary file not shown.

devkit-mac-amd64

-26.3 MB
Binary file not shown.

devkit-mac-arm64

-25.1 MB
Binary file not shown.

new_fork

Lines changed: 0 additions & 1 deletion
This file was deleted.

pkg/supabase/supabase.go

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@ package supabase
33
import (
44
"bytes"
55
"image"
6-
"image/jpeg"
76
"os"
87
"path/filepath"
98
"strings"
109

1110
"github.com/chai2010/webp"
1211
"github.com/darwishdev/devkit-cli/pkg/config"
1312
supaapigo "github.com/darwishdev/supaapi-go"
14-
"github.com/kolesa-team/go-webp/encoder"
15-
webpencoder "github.com/kolesa-team/go-webp/webp"
1613
"github.com/rs/zerolog/log"
1714
"github.com/supabase-community/auth-go/types"
1815
storage_go "github.com/supabase-community/storage-go"
@@ -102,45 +99,45 @@ func (s *SupabaseClient) StorageSeed(conf *config.ProjectConfig, filesPath strin
10299
}
103100
continue
104101
}
105-
if strings.Contains(contentType, "jpeg") {
106-
fileOpened, err := os.Open(filePath)
107-
if err != nil {
108-
return err
109-
}
110-
111-
img, err := jpeg.Decode(fileOpened)
112-
if err != nil {
113-
114-
log.Debug().Msg("jpeeeg")
115-
return err
116-
}
117-
options, err := encoder.NewLossyEncoderOptions(encoder.PresetDefault, 75)
118-
if err != nil {
119-
log.Debug().Msg("NewLossyEncoderOptions new")
120-
return err
121-
}
122-
123-
var bufferOutput bytes.Buffer
124-
if err := webpencoder.Encode(&bufferOutput, img, options); err != nil {
125-
log.Debug().Msg("ebpencoder new")
126-
return err
127-
}
128-
webpData := bufferOutput.Bytes()
129-
fileReader := bytes.NewReader(webpData)
130-
newFileName := strings.Replace(fileName, "jpeg", "webp", 1)
131-
newFileName = strings.Replace(newFileName, "jpg", "webp", 1)
132-
newContenType := "image/webp"
133-
fileOpts := storage_go.FileOptions{
134-
ContentType: &newContenType,
135-
Upsert: &upsert,
136-
}
137-
_, err = supaapi.StorageClient.UploadFile(bucket, newFileName, fileReader, fileOpts)
138-
if err != nil {
139-
return err
140-
}
141-
continue
142-
143-
}
102+
// if strings.Contains(contentType, "jpeg") {
103+
// fileOpened, err := os.Open(filePath)
104+
// if err != nil {
105+
// return err
106+
// }
107+
//
108+
// img, err := jpeg.Decode(fileOpened)
109+
// if err != nil {
110+
//
111+
// log.Debug().Msg("jpeeeg")
112+
// return err
113+
// }
114+
// // options, err := encoder.NewLossyEncoderOptions(encoder.PresetDefault, 75)
115+
// // if err != nil {
116+
// // log.Debug().Msg("NewLossyEncoderOptions new")
117+
// // return err
118+
// // }
119+
// //
120+
// // var bufferOutput bytes.Buffer
121+
// // if err := webpencoder.Encode(&bufferOutput, img, options); err != nil {
122+
// // log.Debug().Msg("ebpencoder new")
123+
// // return err
124+
// // }
125+
// // webpData := bufferOutput.Bytes()
126+
// // fileReader := bytes.NewReader(webpData)
127+
// // newFileName := strings.Replace(fileName, "jpeg", "webp", 1)
128+
// // newFileName = strings.Replace(newFileName, "jpg", "webp", 1)
129+
// // newContenType := "image/webp"
130+
// fileOpts := storage_go.FileOptions{
131+
// ContentType: &newContenType,
132+
// Upsert: &upsert,
133+
// }
134+
// _, err = supaapi.StorageClient.UploadFile(bucket, fileName, fileReader, fileOpts)
135+
// if err != nil {
136+
// return err
137+
// }
138+
// continue
139+
//
140+
// }
144141
log.Debug().Interface("filename ", filePath).Msg("process")
145142
compressedFile, err := s.CompressImage(file, 70, contentType)
146143
if err != nil {

0 commit comments

Comments
 (0)