Skip to content

Commit

Permalink
Merge pull request #64 from parkervcp/better_image_parsin_fix
Browse files Browse the repository at this point in the history
use better fix
  • Loading branch information
parkervcp committed May 17, 2024
2 parents 3b6846a + 6102750 commit 9183619
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions parsing.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package main

import (
"errors"
"image"
"image/png"
_ "image/jpeg"
_ "image/png"
"io"
"net/http"
"os"
Expand Down Expand Up @@ -110,15 +110,7 @@ func getImageDimension(imagePath string) (imageData image.Config, err error) {
return
}

switch {
case strings.HasSuffix(imagePath, ".png"):
imageData, err = png.DecodeConfig(file)
case strings.HasSuffix(imagePath, ".jpg"):
imageData, _, err = image.DecodeConfig(file)
default:
err = errors.New("unsupported image type")
}

imageData, _, err = image.DecodeConfig(file)
if err != nil {
Log.Error("error decoding image")
return
Expand Down

0 comments on commit 9183619

Please sign in to comment.