func (ih *ImageHelper) ScaleImage(img image.Image, config models.UploadModel) { bucket := ih.Config.GetImageBucket(config.GetBucket()) var width, height string var w, h int fileType := config.GetConversionType() for index, _ := range bucket.Width { width = bucket.Width[index] height = bucket.Height[index] buf := new(bytes.Buffer) w, _ = strconv.Atoi(width) h, _ = strconv.Atoi(height) m := resize.Resize(uint(w), uint(h), img, resize.MitchellNetravali) ih.Encode(buf, m, fileType) pathname := config.GetFilePath() + utils.S3_SEPARATOR + ih.fileName + "_" + width + "x" + height + "." + fileType go ih.UploadToS3(buf, pathname, "image/"+fileType) } }