@@ -273,7 +273,7 @@ func NewImageHelper(endpoint string, fs FileSaver) *imageProcessHelper {
273
273
}
274
274
}
275
275
276
- func (ip * imageProcessHelper ) GetDimensions (bts [] byte , ext string ) (width int , height int , err error ) {
276
+ func (ip * imageProcessHelper ) GetDimensions (bts io. Reader , ext string ) (width int , height int , err error ) {
277
277
ext = strings .ToLower (ext )
278
278
var imgConfig image.Config
279
279
if strings .HasSuffix (ext , "jpeg" ) || strings .HasSuffix (ext , "jpg" ) {
@@ -287,7 +287,7 @@ func (ip *imageProcessHelper) GetDimensions(bts []byte, ext string) (width int,
287
287
return imgConfig .Width , imgConfig .Width , nil
288
288
}
289
289
290
- func (ip * imageProcessHelper ) ProcessImage (filename string , bts [] byte , ops * operations ) (byts * bytes.Buffer , fileName string , url string , err error ) {
290
+ func (ip * imageProcessHelper ) ProcessImage (filename string , imgData io. Reader , ops * operations ) (byts * bytes.Buffer , fileName string , url string , err error ) {
291
291
ext := filepath .Ext (filename )
292
292
293
293
bOps , err := json .Marshal (ops .Ops )
@@ -302,7 +302,7 @@ func (ip *imageProcessHelper) ProcessImage(filename string, bts []byte, ops *ope
302
302
return nil , "" , "" , fmt .Errorf ("mpW.CreateFormFile %v" , err )
303
303
// ctx.ErrorJSON(http.StatusOK, "couldn't create form file ", err)
304
304
}
305
- _ , err = io .Copy (fw , bytes . NewBuffer ( bts ) )
305
+ _ , err = io .Copy (fw , imgData )
306
306
if err != nil {
307
307
// ctx.ErrorJSON(http.StatusOK, "failed to copy from reqFile", err)
308
308
return nil , "" , "" , fmt .Errorf ("failed to copy to multipart writer %v" , err )
0 commit comments