Skip to content

Commit

Permalink
return error in convert util
Browse files Browse the repository at this point in the history
  • Loading branch information
logica0419 committed Dec 8, 2023
1 parent cbcab23 commit 4b6339b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions service/imaging/processor_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (p *defaultProcessor) FitAnimationGIF(srcFile io.Reader, width, height int)
}
// 画像が十分小さければスキップ
if srcWidth <= width && srcHeight <= height {
return imaging2.GifToBytesReader(src), nil
return imaging2.GifToBytesReader(src)
}

// 元の比率を保つよう調整
Expand Down Expand Up @@ -117,7 +117,7 @@ func (p *defaultProcessor) FitAnimationGIF(srcFile io.Reader, width, height int)
dst.Image = append(dst.Image, d)
}

return imaging2.GifToBytesReader(src), nil
return imaging2.GifToBytesReader(src)
}

func (p *defaultProcessor) WaveformMp3(src io.ReadSeeker, width, height int) (r io.Reader, err error) {
Expand Down
6 changes: 3 additions & 3 deletions utils/imaging/gif.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
)

// GifToBytesReader GIF画像を*bytes.Readerに書き出します
func GifToBytesReader(src *gif.GIF) *bytes.Reader {
func GifToBytesReader(src *gif.GIF) (*bytes.Reader, error) {
buf := new(bytes.Buffer)
if err := gif.EncodeAll(buf, src); err != nil {
panic(err)
return nil, err
}
return bytes.NewReader(buf.Bytes())
return bytes.NewReader(buf.Bytes()), nil
}

0 comments on commit 4b6339b

Please sign in to comment.