Skip to content

Commit

Permalink
Fix incorrect croped image
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhu committed Mar 28, 2018
1 parent 16608ea commit 6e647cb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions handlers.go
Expand Up @@ -153,8 +153,10 @@ func (imageHandler) Handle(media Media, file FileInterface, option *Option) (err
} else {
if img, _, err := image.Decode(file); err == nil {
// save original image
if cropOption := media.GetCropOption("original"); cropOption != nil {
img = imaging.Crop(img, *cropOption)
if len(media.GetSizes()) == 0 {
if cropOption := media.GetCropOption("original"); cropOption != nil {
img = imaging.Crop(img, *cropOption)
}
}

// Save default image
Expand Down

0 comments on commit 6e647cb

Please sign in to comment.