switched from s3 to disk for saving icons
This commit is contained in:
parent
113a261dae
commit
5b3f6a6870
9 changed files with 84 additions and 112 deletions
|
|
@ -2,7 +2,6 @@ package main
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"image"
|
||||
|
|
@ -14,11 +13,11 @@ import (
|
|||
_ "golang.org/x/image/webp"
|
||||
)
|
||||
|
||||
// convertIconToBase64PNG downloads an icon from S3, converts it to PNG, and returns base64-encoded data.
|
||||
func convertIconToBase64PNG(ctx context.Context, s3Key string, iconsBucket string) (encoded string, width, height int, err error) {
|
||||
data, err := s3Download(ctx, iconsBucket, s3Key)
|
||||
// convertIconToBase64PNG reads an icon from disk, converts it to PNG, and returns base64-encoded data.
|
||||
func convertIconToBase64PNG(hash string, iconsDir string) (encoded string, width, height int, err error) {
|
||||
data, err := readIconFromDisk(iconsDir, hash)
|
||||
if err != nil {
|
||||
return "", 0, 0, fmt.Errorf("s3 download: %w", err)
|
||||
return "", 0, 0, fmt.Errorf("read icon: %w", err)
|
||||
}
|
||||
|
||||
// Check for SVG (can't decode to raster without external deps)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue