diff --git a/Dockerfile b/Dockerfile index c74e6f5..e7d4202 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ WORKDIR /app/ ADD go.mod go.sum ./ RUN go mod download ADD . . -RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-w -s" -o tweetsvg main.go +RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-w -s" -o tweetsvg . FROM scratch WORKDIR /app/ diff --git a/main.go b/main.go index a347f60..46457e2 100644 --- a/main.go +++ b/main.go @@ -162,7 +162,11 @@ func getTweet(w http.ResponseWriter, r *http.Request) { if len(tweet.ExtendedEntities.Media) >= 1 { ratio := float64(tweet.ExtendedEntities.Media[0].Sizes.Small.W) / 464 - height += (float64(tweet.ExtendedEntities.Media[0].Sizes.Small.H) / ratio) + 5 + if len(tweet.ExtendedEntities.Media) == 2 { + height += ((float64(tweet.ExtendedEntities.Media[0].Sizes.Small.H) / ratio) + 5) / 2 + } else { + height += (float64(tweet.ExtendedEntities.Media[0].Sizes.Small.H) / ratio) + 5 + } } if len(tweet.ExtendedEntities.Media) > 1 {