Kaynağa Gözat

Merge pull request #170 from qor5/fix-media-vips

media vips: fix default size key
xuxinx 1 yıl önce
ebeveyn
işleme
8839ceeda7
1 değiştirilmiş dosya ile 3 ekleme ve 3 silme
  1. 3 3
      media/vips/vips.go

+ 3 - 3
media/vips/vips.go

@@ -83,7 +83,7 @@ func (bimgImageHandler) Handle(m media.Media, file media.FileInterface, option *
 			return err
 		}
 		for key, _ := range m.GetSizes() {
-			if key == "original" {
+			if key == media.DefaultSizeKey {
 				continue
 			}
 			img := copyImage(buffer.Bytes())
@@ -106,7 +106,7 @@ func (bimgImageHandler) Handle(m media.Media, file media.FileInterface, option *
 		img := copyImage(buffer.Bytes())
 		bimgOption := bimg.Options{Quality: quality, Palette: true, Compression: PNGCompression}
 		// Crop original image if specified
-		if cropOption := m.GetCropOption("original"); cropOption != nil {
+		if cropOption := m.GetCropOption(media.DefaultSizeKey); cropOption != nil {
 			options := bimg.Options{
 				Quality:    100, // Don't compress twice
 				Top:        cropOption.Min.Y,
@@ -137,7 +137,7 @@ func (bimgImageHandler) Handle(m media.Media, file media.FileInterface, option *
 
 	// Handle size images
 	for key, size := range m.GetSizes() {
-		if key == "original" {
+		if key == media.DefaultSizeKey {
 			continue
 		}
 		img := copyImage(buffer.Bytes())